Skip to content

Commit 5b16129

Browse files
committed
Add documentation for configuration
Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
1 parent 5babcc4 commit 5b16129

5 files changed

Lines changed: 56 additions & 3 deletions

File tree

doc/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
# General information about the project.
6464
project = pkgdist.MODULE_NAME
6565
authors = ''
66-
copyright = '2021, pkgdev contributors'
66+
copyright = '2021-2022, pkgdev contributors'
6767

6868
# The version info for the project you're documenting, acts as replacement for
6969
# |version| and |release|, also used in various other places throughout the

doc/man/config.rst

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
Config file support
2+
===================
3+
4+
Config files are supported by most subcommands of ``pkgdev`` from any of three
5+
locations. Listed in order of increasing precedence these include the
6+
following:
7+
8+
- system config -- /etc/pkgdev/pkgdev.conf
9+
- user config -- ~/.config/pkgdev/pkgdev.conf
10+
- custom config -- specified via the --config option
11+
12+
Any settings from a config file with higher precedence will override matching
13+
settings from a config file with a lower precedence, e.g. user settings
14+
override system settings. Note that command line options override any matching
15+
config file setting.
16+
17+
In terms of file structure, basic INI formatting is required and allows
18+
creating a default section (DEFAULT) for system-wide settings or repo-specific
19+
sections. The INI key-value pairs directly relate to the available
20+
long-options supported by the various prefixed by the subcommand name and their
21+
related values. To find all possible configuration options, run:
22+
``pkgdev {subcommand} --help``. See the following examples for config settings:
23+
24+
- Run ``pkgcheck scan`` before committing and asks for confirmation (instead of
25+
aborting) when creating commits with QA errors::
26+
27+
[DEFAULT]
28+
commit.scan = true
29+
commit.ask = true
30+
31+
- Allow pushing commits with QA errors, but only for the 'gentoo' repository::
32+
33+
[gentoo]
34+
push.ask = true
35+
36+
- When committing, stage all files in current working directory (note that this
37+
option doesn't expect value, therefore no value is defined post equal sign)::
38+
39+
[DEFAULT]
40+
commit.all =
41+
42+
- All previous config settings combined::
43+
44+
[DEFAULT]
45+
commit.scan = true
46+
commit.ask = true
47+
commit.all =
48+
49+
[gentoo]
50+
push.ask =

doc/man/pkgdev.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ pkgdev
77
.. include:: pkgdev/_options.rst
88
.. include:: pkgdev/_subcommands.rst
99

10+
.. include:: config.rst
11+
1012
Reporting Bugs
1113
==============
1214

src/pkgdev/scripts/pkgdev_commit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def __call__(self, parser, namespace, value, option_string=None):
103103
out if any failures are found.
104104
""")
105105
commit_opts.add_argument(
106-
'-A', '--ask', action='store_true',
106+
'-A', '--ask', nargs='?', const=True, action=arghparse.StoreBool,
107107
help='confirm creating commit with QA errors',
108108
docs="""
109109
When running with the -s/--scan option enabled, ``pkgdev commit`` will

src/pkgdev/scripts/pkgdev_push.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import shlex
33

44
from pkgcheck import reporters, scan
5+
from snakeoil.cli import arghparse
56
from snakeoil.cli.input import userquery
67

78
from .. import cli, git
@@ -26,7 +27,7 @@ def parse_known_args(self, args=None, namespace=None):
2627
push.add_argument('--pkgcheck-scan', help=argparse.SUPPRESS)
2728
push_opts = push.add_argument_group('push options')
2829
push_opts.add_argument(
29-
'-A', '--ask', action='store_true',
30+
'-A', '--ask', nargs='?', const=True, action=arghparse.StoreBool,
3031
help='confirm pushing commits with QA errors')
3132
push_opts.add_argument(
3233
'-n', '--dry-run', action='store_true',

0 commit comments

Comments
 (0)