Skip to content

Commit

Permalink
Usage help: don't mark mandatory option parameters as optional
Browse files Browse the repository at this point in the history
  • Loading branch information
kontura committed Feb 11, 2025
1 parent f54b86f commit 2667cd3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion dnf/cli/commands/repoquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def set_argparser(parser):
parser.add_argument('--show-duplicates', action='store_true',
help=_("Query all versions of packages (default)"))
parser.add_argument('--arch', '--archlist', dest='arches', default=[],
action=_CommaSplitCallback, metavar='[arch]',
action=_CommaSplitCallback, metavar='ARCH',
help=_('show only results from this ARCH'))
parser.add_argument('-f', '--file', metavar='FILE', nargs='+',
help=_('show only results that owns FILE'))
Expand Down
28 changes: 14 additions & 14 deletions dnf/cli/option_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def _add_general_options(self):
general_grp = self.add_argument_group(_('General {prog} options'.format(
prog=dnf.util.MAIN_PROG_UPPER)))
general_grp.add_argument("-c", "--config", dest="config_file_path",
default=None, metavar='[config file]',
default=None, metavar='CONFIG_FILE',
help=_("config file location"))
general_grp.add_argument("-q", "--quiet", dest="quiet",
action="store_true", default=None,
Expand All @@ -182,7 +182,7 @@ def _add_general_options(self):
help=_("show {prog} version and exit").format(
prog=dnf.util.MAIN_PROG_UPPER))
general_grp.add_argument("--installroot", help=_("set install root"),
metavar='[path]')
metavar='PATH]')
general_grp.add_argument("--nodocs", action="store_const", const=['nodocs'], dest='tsflags',
help=_("do not install documentations"))
general_grp.add_argument("--noplugins", action="store_false",
Expand All @@ -191,11 +191,11 @@ def _add_general_options(self):
general_grp.add_argument("--enableplugin", dest="enableplugin",
default=[], action=self._SplitCallback,
help=_("enable plugins by name"),
metavar='[plugin]')
metavar='PLUGIN]')
general_grp.add_argument("--disableplugin", dest="disableplugin",
default=[], action=self._SplitCallback,
help=_("disable plugins by name"),
metavar='[plugin]')
metavar='PLUGIN]')
general_grp.add_argument("--releasever", default=None,
help=_("override the value of $releasever"
" in config and repo files"))
Expand Down Expand Up @@ -229,10 +229,10 @@ def _add_general_options(self):
help=_("run entirely from system cache, "
"don't update cache"))
general_grp.add_argument("-R", "--randomwait", dest="sleeptime", type=int,
default=None, metavar='[minutes]',
default=None, metavar='MINUTES',
help=_("maximum command wait time"))
general_grp.add_argument("-d", "--debuglevel", dest="debuglevel",
metavar='[debug level]', default=None,
metavar='DEBUG_LEVEL', default=None,
help=_("debugging output level"), type=int)
general_grp.add_argument("--debugsolver",
action="store_true", default=None,
Expand All @@ -252,28 +252,28 @@ def _add_general_options(self):
"repoquery").format(prog=dnf.util.MAIN_PROG))
general_grp.add_argument("--rpmverbosity", default=None,
help=_("debugging output level for rpm"),
metavar='[debug level name]')
metavar='DEBUG_LEVEL_NAME')
general_grp.add_argument("-y", "--assumeyes", action="store_true",
default=None, help=_("automatically answer yes"
" for all questions"))
general_grp.add_argument("--assumeno", action="store_true",
default=None, help=_("automatically answer no"
" for all questions"))
general_grp.add_argument("--enablerepo", action=self._RepoCallback,
dest='repos_ed', default=[], metavar='[repo]',
dest='repos_ed', default=[], metavar='REPO',
help=_("Temporarily enable repositories for the purpose "
"of the current dnf command. Accepts an id, a "
"comma-separated list of ids, or a glob of ids. "
"This option can be specified multiple times."))
repo_group = general_grp.add_mutually_exclusive_group()
repo_group.add_argument("--disablerepo", action=self._RepoCallback,
dest='repos_ed', default=[], metavar='[repo]',
dest='repos_ed', default=[], metavar='REPO',
help=_("Temporarily disable active repositories for the "
"purpose of the current dnf command. Accepts an id, "
"a comma-separated list of ids, or a glob of ids. "
"This option can be specified multiple times, but "
"is mutually exclusive with `--repo`."))
repo_group.add_argument('--repo', '--repoid', metavar='[repo]', dest='repo',
repo_group.add_argument('--repo', '--repoid', metavar='REPO', dest='repo',
action=self._SplitCallback, default=[],
help=_('enable just specific repositories by an id or a glob, '
'can be specified multiple times'))
Expand All @@ -289,15 +289,15 @@ def _add_general_options(self):
general_grp.add_argument("-x", "--exclude", "--excludepkgs", default=[],
dest='excludepkgs', action=self._SplitCallback,
help=_("exclude packages by name or glob"),
metavar='[package]')
metavar='PACKAGE')
general_grp.add_argument("--disableexcludes", "--disableexcludepkgs",
default=[], dest="disable_excludes",
choices=['all', 'main', 'REPOID'],
action=self._SplitCallback,
help=_("disable excludepkgs"),
metavar='[repo]')
help=_("disable excludepkgs"))
general_grp.add_argument("--repofrompath", default={},
action=self._SplitExtendDictCallback,
metavar='[repo,path]',
metavar='REPO,PATH',
help=_("label and path to an additional repository to use (same "
"path as in a baseurl), can be specified multiple times."))
general_grp.add_argument("--noautoremove", action="store_false",
Expand Down

0 comments on commit 2667cd3

Please sign in to comment.