diff --git a/docs/wrap_cli.md b/docs/wrap_cli.md index 3791f7d..d48ae43 100644 --- a/docs/wrap_cli.md +++ b/docs/wrap_cli.md @@ -39,3 +39,80 @@ dash_config: # Dash related config console_interval: 2000 ``` + +You can generate this file to your working path, using: + +```bash +$ python -m oneface.wrap_cli generate ./example.yaml +``` + +Then you can lanuch the application with: + +```bash +$ python -m oneface.wrap_cli run example.yaml qt_gui # or +$ python -m oneface.wrap_cli run example.yaml dash_app +``` + + +## Command insert + +Extra string can insert to the actually executed command when the +parameter is a `bool` type. It's useful when the command contains some +"Flag" parameters. For example: + +```YAML +name: add + +command: python {verbose} -c "print({a} + {b})" + +arguments: + + verbose: + type: bool + default: False + true_insert: "-v" # insert "-v" flag when verbose is True + false_insert: "" + + a: + type: int + range: [0, 10] + + b: + type: int + range: [-10, 10] + default: 0 +``` + + +## Configurations + +You can modify the configuration related to +the specific interface([Qt](./qt_confs.md) and [Dash](./dash_confs.md)). +Using the corresponding fields, for example: + +```YAML +qt_config: + name: "my qt app" + size: [300, 200] + run_once: False + +dash_config: + host: 127.0.0.1 + port: 8989 + show_console: True + console_interval: 2000 + init_run: True +``` + +And parameter related configrations should set to the corresponding argument fields. +For example: + +```YAML +arguments: + + a: + type: int + range: [0, 10] + interactive: True # will let this argument interactive in dash app + +``` diff --git a/oneface/wrap_cli/__main__.py b/oneface/wrap_cli/__main__.py index 2bf2c35..78b6d2e 100644 --- a/oneface/wrap_cli/__main__.py +++ b/oneface/wrap_cli/__main__.py @@ -12,7 +12,7 @@ EXAMPLE_FILE = osp.join(FILE_DIR, "example.yaml") -def gen(target_path: str = "./oneface.yaml"): +def gen(target_path: str = "./example.yaml"): print(f"Generate an example config file in: {target_path}") with open(EXAMPLE_FILE) as f: content = f.read()