Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Nanguage committed Sep 16, 2022
1 parent 329b12a commit b24d3bd
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 1 deletion.
77 changes: 77 additions & 0 deletions docs/wrap_cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

```
2 changes: 1 addition & 1 deletion oneface/wrap_cli/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit b24d3bd

Please sign in to comment.