-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #503 from JrGoodle/positional-args
Convert commands to use positional args
- Loading branch information
Showing
96 changed files
with
1,572 additions
and
2,005 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# -*- coding: utf-8 -*- | ||
"""Clowder command line branch controller | ||
.. codeauthor:: Joe Decapo <joe@polka.cat> | ||
""" | ||
|
||
import argparse | ||
|
||
from clowder.clowder_controller import CLOWDER_CONTROLLER | ||
from clowder.util.clowder_utils import ( | ||
add_parser_arguments, | ||
filter_projects, | ||
options_help_message | ||
) | ||
from clowder.util.decorators import ( | ||
print_clowder_repo_status, | ||
valid_clowder_yaml_required | ||
) | ||
|
||
|
||
def add_branch_parser(subparsers: argparse._SubParsersAction) -> None: # noqa | ||
|
||
arguments = [ | ||
(['projects'], dict(metavar='PROJECT', default='all', nargs='*', choices=CLOWDER_CONTROLLER.project_choices, | ||
help=options_help_message(CLOWDER_CONTROLLER.project_names, | ||
'projects and groups to show branches for'))), | ||
(['--all', '-a'], dict(action='store_true', help='show local and remote branches')), | ||
(['--remote', '-r'], dict(action='store_true', help='show remote branches')) | ||
] | ||
|
||
parser = subparsers.add_parser('branch', help='Display current branches') | ||
add_parser_arguments(parser, arguments) | ||
parser.set_defaults(func=branch) | ||
|
||
|
||
def branch(args) -> None: | ||
"""Clowder branch command entry point""" | ||
_branch(args) | ||
|
||
|
||
@valid_clowder_yaml_required | ||
@print_clowder_repo_status | ||
def _branch(args) -> None: | ||
"""Clowder branch command private implementation""" | ||
local = True | ||
remote = False | ||
if args.all: | ||
local = True | ||
remote = True | ||
elif args.remote: | ||
remote = True | ||
|
||
projects = filter_projects(CLOWDER_CONTROLLER.projects, args.projects) | ||
for project in projects: | ||
print(project.status()) | ||
project.branch(local=local, remote=remote) |
Oops, something went wrong.