From 329b12a6856e8abb3d32a29db887a7ef586981fb Mon Sep 17 00:00:00 2001 From: Nanguage Date: Fri, 16 Sep 2022 10:20:35 +0800 Subject: [PATCH] update docs --- docs/wrap_cli.md | 41 +++++++++++++++++++++++++++++++++++ mkdocs.yml | 1 + oneface/wrap_cli/example.yaml | 2 -- 3 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 docs/wrap_cli.md diff --git a/docs/wrap_cli.md b/docs/wrap_cli.md new file mode 100644 index 0000000..3791f7d --- /dev/null +++ b/docs/wrap_cli.md @@ -0,0 +1,41 @@ +# Wrap command line + +Another way to use oneFace is to wrap a command line program. +From the perspective of implementation, it's a layer of wrapping +around the oneFace API. You can use a YAML configuration file to +describe the command line to be wrapped and the type, range and default +value of each parameter. + +Here is an example YAML file: + +```YAML +# example.yaml +# The name of your app +name: add + +# The target command to be wraped. +# Use '{}' to mark all arguments. +command: python -c "print({a} + {b})" + +# List all argument's type and range +arguments: + + a: + type: int + range: [0, 10] + + b: + type: int + range: [-10, 10] + default: 0 + +# Interface specific config +# These parameters will pass to the interface +qt_config: + # qt related config + run_once: false + +dash_config: + # Dash related config + console_interval: 2000 +``` diff --git a/mkdocs.yml b/mkdocs.yml index 54ad120..13494e9 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -12,6 +12,7 @@ nav: - Interface configuration: - Qt configs: qt_confs.md - Dash configs: dash_confs.md + - Wrap command line: wrap_cli.md markdown_extensions: - pymdownx.highlight: diff --git a/oneface/wrap_cli/example.yaml b/oneface/wrap_cli/example.yaml index e9e1033..5087c18 100644 --- a/oneface/wrap_cli/example.yaml +++ b/oneface/wrap_cli/example.yaml @@ -17,7 +17,6 @@ arguments: range: [-10, 10] default: 0 - # Interface specific config # These parameters will pass to the interface qt_config: @@ -27,4 +26,3 @@ qt_config: dash_config: # Dash related config console_interval: 2000 -