Skip to content

os.cmdline #

fn only_non_options #

fn only_non_options(args []string) []string

Fetch all options not start with '-', e.g. args: ['-d', 'aa', '--help', 'bb'] ret: ['aa', 'bb']

fn only_options #

fn only_options(args []string) []string

Fetch all options start with '-', e.g. args: ['-d', 'aa', '--help', 'bb'] ret: ['-d', '--help']

fn option #

fn option(args []string, param string, def string) string

Fetch option by param, e.g. args: ['v', '-d', 'aa'] param: '-d' def: '' ret: 'aa'

fn options #

fn options(args []string, param string) []string

Fetch multiple option by param, e.g. args: ['v', '-d', 'aa', '-d', 'bb', '-d', 'cc'] param: '-d' ret: ['aa', 'bb', 'cc']

fn options_after #

fn options_after(args []string, what []string) []string

Fetch all options after what params, e.g. args: ['-stat', 'test', 'aaa.v'] what: ['test'] ret: ['aaa.v']

fn options_before #

fn options_before(args []string, what []string) []string

Fetch all options before what params, e.g. args: ['-stat', 'test', 'aaa.v'] what: ['test'] ret: ['-stat']