action

Attr of the action code itself of the command or subcommand for each language that you want to support

type

attribute set of string

default

{
  action = {
    bash = "exit 0";
    c = "exit(0);";
  };
}

allowExtraArguments

Allow the command to receive unmatched arguments

type

boolean

default

{
  allowExtraArguments = false;
}

description

Command description

type

string

default

{
  description = "Example cli script generated with nix";
}

flags

Command flags

type

list of submodule

default

{
  flags = [];
}

flags.*.description

Description of the flag value

type

string

default

{
  flags.*.description = "";
}

flags.*.keywords

Which keywords refer to this flag

type

non-empty list of string matching the pattern -[a-zA-Z0-9]|-(-[a-z0-9]*)

default

{
  flags.*.keywords = [];
}

flags.*.required

Is the value required?

type

boolean

default

{
  flags.*.required = false;
}

flags.*.validator

Command to run passing the input to validate the flag value

type

string

default

{
  flags.*.validator = "any";
}

flags.*.variable

Variable to store the result

type

string matching the pattern [A-Z][A-Z_]*

name

Name of the command shown on --help

type

string matching the pattern [a-zA-Z0-9_][a-zA-Z0-9_-]*

default

{
  name = "example";
}

subcommands

Subcommands has all the attributes of commands, even subcommands...

type

attribute set of submodule

default

{
  subcommands = {};
}

subcommands.<name>.name

This is a recursive from command

type

string

default

{
  subcommands.<name>.name = "...";
}

target.bash.code

Code output

type

strings concatenated with "\n"

target.bash.drv

Package using the shell script version as a binary

type

package

target.bash.prelude

Stuff that must be added before the argument parser

type

strings concatenated with "\n"

default

{
  target.bash.prelude = "";
}

target.bash.shebang

Script shebang

type

string

default

{
  target.bash.shebang = "#!/usr/bin/env bash";
}

target.bash.validators

Parameter validators

type

attribute set of string