#ini #command #execute #value #section #properties

app ini2command

Create a command from a value of an INI-file and execute it

3 releases

0.1.2 Jun 3, 2020
0.1.1 Jun 3, 2020
0.1.0 Jun 3, 2020

#21 in #property

MIT/Apache

13KB
238 lines

ini2command

Installation & Update

With cargo:

cargo install ini2command --force

Command Line

ini2command 1.0
Create a command from a value of an INI-file and execute it.

USAGE:
    ini2command [FLAGS] [OPTIONS] --ini <FILE> --property <NAME> [--] <COMMAND>...

FLAGS:
    -d, --dry        Print the command instead of executing it.
    -h, --help       Prints help information
    -V, --version    Prints version information

OPTIONS:
    -i, --ini <FILE>                The path to the ini file
    -p, --property <NAME>           The property to use
    -r, --search_string <STRING>    The search string for use in the template [default: {}]
    -s, --section <NAME>            The section to use

ARGS:
    <COMMAND>...    The command template

Examples

conf.ini:

ip=8.8.8.8

[addresses]
server1=1.1.1.1

For global properties:

ini2command -i conf.ini -p ip -- ping {}

For properties within sections:

ini2command -i conf.ini -s addresses -p server1 -- ping {}

If {} cannot be used for some reason:

ini2command -i conf.ini -p ip -r @@ -- ping @@

Dependencies

~6.5MB
~171K SLoC