Skip to content

Commit

Permalink
[bin] updated cli examples
Browse files Browse the repository at this point in the history
  • Loading branch information
nemesifier committed Dec 11, 2015
1 parent f55cc4a commit 7083cdb
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions docs/source/general/commandline_utility.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ languages (via system calls).
Check out the available options yourself with::

$ netjsonconfig --help
usage: netjsonconfig [-h] [--config CONFIG]
[--templates [TEMPLATES [TEMPLATES ...]]]
[--backend {openwrt,openwisp}]
[--method {render,generate}] [--verbose] [--version]
usage: netjsonconfig [-h] --config CONFIG
[--templates [TEMPLATES [TEMPLATES ...]]] --backend
{openwrt,openwisp} --method {render,generate,write}
[--args [ARGS [ARGS ...]]] [--verbose] [--version]

Converts a NetJSON DeviceConfiguration object to native router configurations.
Exhaustive documentation is available at: http://netjsonconfig.openwisp.org/

optional arguments:
-h, --help show this help message and exit
Expand All @@ -30,25 +31,35 @@ Check out the available options yourself with::
output:
--backend {openwrt,openwisp}, -b {openwrt,openwisp}
Configuration backend: openwrt or openwisp
--method {render,generate}, -m {render,generate}
--method {render,generate,write}, -m {render,generate,write}
Backend method to use. "render" returns the
configuration in text format"generate" returns a
tar.gz archive as output;
tar.gz archive as output; "write" is like generate but
writes to disk;
--args [ARGS [ARGS ...]], -a [ARGS [ARGS ...]]
Optional arguments that can be passed to methods

debug:
--verbose verbose output
--version, -v show program's version number and exit


Here's the common use cases explained::

# generate tar.gz from a NetJSON DeviceConfiguration object and save it to a file
# generate tar.gz from a NetJSON DeviceConfiguration object and save its output to a file
netjsonconfig --config config.json --backend openwrt --method generate > config.tar.gz

# use write configuration archive to disk in /tmp/routerA.tar.gz
netjsonconfig --config config.json --backend openwrt --method write --args name=routerA path=/tmp/

# see output of OpenWrt render method
netjsonconfig --config config.json --backend openwrt --method render

# same as previous but exclude additional files
netjsonconfig --config config.json --backend openwrt --method render --args files=0

# abbreviated options
netjsonconfig -c config.json -b openwrt -m render
netjsonconfig -c config.json -b openwrt -m render -a files=0

# passing a JSON string instead of a file path
netjsonconfig -c '{"general": { "hostname": "example" }}' -b openwrt -m render
Expand Down

0 comments on commit 7083cdb

Please sign in to comment.