Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add cli prompt support for cirque home #6

Merged
merged 1 commit into from
Jul 15, 2020

Conversation

mingchik
Copy link
Collaborator

@mingchik mingchik commented Jul 9, 2020

Usage:
cirque> create_home
cirque> create_device --type wifi_ap
cirque> create_device --type generic_node_image --capability WiFi,Thread,Interactive --rcp_mode
cirque> home_devices (list all the devices)
cirque> device_state --device_id <device_id>
cirque> run_exec --device_id <device_id> --command (run
command inside docker container)
cirque> close_device --device_id <device_id>
cirque> destroy_home

@yunhanw-google
Copy link
Collaborator

./cirque/common/cirqueprompt.py:25:1: E302 expected 2 blank lines, found 1
make: *** [Makefile:166: pretty-check] Error 1
##[error]Process completed with exit code 2.

parser.add_argument('--base_image', type=str)
parser.add_argument('--capability', type=str)
parser.add_argument('--rcp_mode', action='store_true', default=False)
parser.add_argument('--weave_config_file', type=str)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

create_device is generic CLI command, which should not have weave_config_file

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ack



class CirquePrompt(cmd.Cmd):
prompt = 'cirque> '
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add help function
please add list homes
please add list devices
please add send_cmd which can send command to particular device.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there any chances that developer would create multiple homes locally?
help function, ack!
home_devces = list devices
run_exec = send_cmd

Copy link
Contributor

@gjc13 gjc13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd also suggest to use prompt_toolkit to read cli input which provides many fancy features such as history and reverse-i-search.

'type': args.type,
'base_image': args.base_image if args.base_image else None,
'capability': capabilities,
'rcp_mode': True if args.base_image else False,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'rcp_mode': True if args.base_image else False,
'rcp_mode': True if args.rcp_mode else False,

@mingchik mingchik force-pushed the feature/cirque_cli_support branch 4 times, most recently from fe66d12 to 464be50 Compare July 14, 2020 19:42
Copy link
Contributor

@gjc13 gjc13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally LGTM. A small lint issue.

cirque/common/cirqueprompt.py Outdated Show resolved Hide resolved
@mingchik mingchik force-pushed the feature/cirque_cli_support branch 4 times, most recently from 06e8446 to dd93a4a Compare July 15, 2020 03:53
Usage:
  cirque> create_home
  cirque> create_device --type wifi_ap
  cirque> create_device --type generic_node_image --capability WiFi,Thread,Interactive --rcp_mode
  cirque> device_state --device_id <device_id>
  cirque> close_device --device_id <device_id>
  cirque> homes (list all the homes)
  cirque> home_devices (list all the devices)
  cirque> run_exec --device_id <device_id> --command <command> (run
  command inside docker container)
  cirque> destroy_home
  cirque> version
  cirque> history
  cirque> exit
Help:
  cirque> help
  Documented commands (use 'help -v' for verbose/'help <topic>' for details):
  ===========================================================================
  close_device   create_home   device_state  help     home_devices  run_exec
  create_device  destroy_home  exit          history  homes         version
@mingchik mingchik merged commit 907f887 into master Jul 15, 2020
@mingchik
Copy link
Collaborator Author

Cirque Command Line Interface

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants