Skip to content

Commit

Permalink
Fix JohnHammond#33 - cmd2 choices_method
Browse files Browse the repository at this point in the history
Update Katana for changes in cmd2 >= 2.0 (June 2021)
  • Loading branch information
eljeffeg committed Sep 14, 2021
1 parent 2ae9440 commit b27084e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
20 changes: 10 additions & 10 deletions katana/repl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ def do_quit(self, args: argparse.Namespace) -> bool:
"directory",
nargs="+",
help="The directories to stop monitoring",
choices_method=get_monitor_choices,
choices_provider=get_monitor_choices,
)
monitor_remove_parser.set_defaults(action="remove")

Expand All @@ -610,7 +610,7 @@ def do_quit(self, args: argparse.Namespace) -> bool:
"directory",
nargs="+",
help="The directories to monitor",
completer_method=functools.partial(
completer=functools.partial(
cmd2.Cmd.path_complete, path_filter=lambda path: os.path.isdir(path)
),
)
Expand Down Expand Up @@ -707,7 +707,7 @@ def do_target(self, args: argparse.Namespace) -> bool:
target_view_parser.add_argument(
"target",
help="The target to view",
choices_method=functools.partial(get_target_choices, uncomplete=False),
choices_provider=functools.partial(get_target_choices, uncomplete=False),
)
target_view_parser.set_defaults(action="view")

Expand Down Expand Up @@ -775,7 +775,7 @@ def _target_view(self, args: argparse.Namespace) -> None:
help="Disable automatic unit selection for recursive targets",
)
target_add_parser.add_argument(
"target", help="the target to evaluate", completer_method=cmd2.Cmd.path_complete
"target", help="the target to evaluate", completer=cmd2.Cmd.path_complete
)
target_add_parser.add_argument(
"option",
Expand Down Expand Up @@ -883,7 +883,7 @@ def _target_add(self, args: argparse.Namespace) -> None:
"target",
nargs="+",
help="the target id (hash) to stop",
choices_method=functools.partial(get_target_choices, uncomplete=True),
choices_provider=functools.partial(get_target_choices, uncomplete=True),
)
target_stop_parser.set_defaults(action="stop")

Expand Down Expand Up @@ -1005,7 +1005,7 @@ def _target_list(self, args: argparse.Namespace) -> None:
target_solution_parser.add_argument(
"target",
help="The target hash or upstream (if --raw is specified)",
choices_method=get_target_choices,
choices_provider=get_target_choices,
)
target_solution_parser.set_defaults(action="solution")

Expand Down Expand Up @@ -1176,7 +1176,7 @@ def do_set(self, args: argparse.Namespace):
"file",
help="Configuration file",
nargs="+",
completer_method=cmd2.Cmd.path_complete,
completer=cmd2.Cmd.path_complete,
)

@cmd2.with_argparser(config_parser)
Expand Down Expand Up @@ -1267,7 +1267,7 @@ def do_ctf(self, args: argparse.Namespace) -> bool:
"challenge_id",
type=str,
help="Challenge ID to submit to",
choices_method=get_challenge_choices,
choices_provider=get_challenge_choices,
)
ctf_submit_parser.add_argument("flag", type=str, help="Flag to submit")
ctf_submit_parser.set_defaults(action="submit")
Expand Down Expand Up @@ -1407,7 +1407,7 @@ def _ctf_list(self, args: argparse.Namespace) -> None:
"challenge_id",
type=str,
help="Challenge ID to queue",
choices_method=get_challenge_choices,
choices_provider=get_challenge_choices,
)
ctf_queue_parser.add_argument(
"option",
Expand Down Expand Up @@ -1665,7 +1665,7 @@ def _ctf_scoreboard(self, args: argparse.Namespace) -> None:
"challenge_id",
type=str,
help="Challenge to view",
choices_method=get_challenge_choices,
choices_provider=get_challenge_choices,
)
ctf_show_parser.set_defaults(action="show")

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ sphinx
sphinx-rtd-theme
gmpy
git+https://github.com/elliptic-shiho/primefac-fork#egg=primefac
cmd2
cmd2>='2.0'
watchdog
regex
dbus-python
Expand Down

0 comments on commit b27084e

Please sign in to comment.