diff options
author | Anish Athalye <me@anishathalye.com> | 2020-03-25 21:38:39 -0400 |
---|---|---|
committer | Anish Athalye <me@anishathalye.com> | 2020-03-26 11:23:07 -0400 |
commit | 7ffaa65482a59fa485e7a8f19fe07a33694fc157 (patch) | |
tree | 78e5990b5934b920b797fe7bace046b3b9bf51c6 /dotbot/cli.py | |
parent | 5d83f9e797b1950199e127a8196803f5e33e0916 (diff) |
Add --only and --except command-line arguments
Internal to Dotbot, we use the name "skip" instead of "except", because
the latter is a keyword, and using a name like "except_" didn't seem as
nice.
Diffstat (limited to 'dotbot/cli.py')
-rw-r--r-- | dotbot/cli.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/dotbot/cli.py b/dotbot/cli.py index 77bd439..258ea87 100644 --- a/dotbot/cli.py +++ b/dotbot/cli.py @@ -28,6 +28,10 @@ def add_options(parser): action='store_true', help='disable built-in plugins') parser.add_argument('--plugin-dir', action='append', dest='plugin_dirs', default=[], metavar='PLUGIN_DIR', help='load all plugins in PLUGIN_DIR') + parser.add_argument('--only', nargs='+', + help='only run specified directives', metavar='DIRECTIVE') + parser.add_argument('--except', nargs='+', dest='skip', + help='skip specified directives', metavar='DIRECTIVE') parser.add_argument('--no-color', dest='no_color', action='store_true', help='disable color output') parser.add_argument('--version', action='store_true', @@ -78,7 +82,7 @@ def main(): # default to directory of config file base_directory = os.path.dirname(os.path.abspath(options.config_file)) os.chdir(base_directory) - dispatcher = Dispatcher(base_directory) + dispatcher = Dispatcher(base_directory, only=options.only, skip=options.skip) success = dispatcher.dispatch(tasks) if success: log.info('\n==> All tasks executed successfully') |