argparse
- Version 3.0.0
- Published
- 187 kB
- No dependencies
- Python-2.0 license
Install
npm i argparseyarn add argparsepnpm add argparseOverview
CLI arguments parser. Native port of python's argparse.
Index
Variables
Interfaces
ArgumentParser
- add_argument_group()
- add_help
- add_mutually_exclusive_group()
- add_subparsers()
- allow_abbrev
- color
- convert_arg_line_to_args()
- description
- epilog
- error()
- exit()
- exit_on_error
- format_help()
- format_usage()
- formatter_class
- fromfile_prefix_chars
- parse_args()
- parse_intermixed_args()
- parse_known_args()
- parse_known_intermixed_args()
- print_help()
- print_usage()
- prog
- suggest_on_error
- usage
Type Aliases
Variables
variable Action
const Action: ActionConstructor;variable ArgumentDefaultsHelpFormatter
const ArgumentDefaultsHelpFormatter: HelpFormatterConstructor;variable ArgumentError
const ArgumentError: ArgumentErrorConstructor;variable ArgumentParser
const ArgumentParser: ArgumentParserConstructor;variable ArgumentTypeError
const ArgumentTypeError: ArgumentTypeErrorConstructor;variable BooleanOptionalAction
const BooleanOptionalAction: BooleanOptionalActionConstructor;variable FileType
const FileType: FileTypeConstructor;variable HelpFormatter
const HelpFormatter: HelpFormatterConstructor;variable MetavarTypeHelpFormatter
const MetavarTypeHelpFormatter: HelpFormatterConstructor;variable Namespace
const Namespace: NamespaceConstructor;variable ONE_OR_MORE
const ONE_OR_MORE: string;variable OPTIONAL
const OPTIONAL: string;variable PARSER
const PARSER: string;variable RawDescriptionHelpFormatter
const RawDescriptionHelpFormatter: HelpFormatterConstructor;variable RawTextHelpFormatter
const RawTextHelpFormatter: HelpFormatterConstructor;variable REMAINDER
const REMAINDER: string;variable SUPPRESS
const SUPPRESS: string;variable ZERO_OR_MORE
const ZERO_OR_MORE: string;Interfaces
interface Action
interface Action {}property choices
choices?: string | readonly unknown[] | object;property const
const?: unknown;property default
default?: unknown;property deprecated
deprecated: boolean;property dest
dest: string;property help
help?: string;property metavar
metavar?: string | string[];property nargs
nargs?: Nargs;property option_strings
option_strings: string[];property required
required: boolean;property type
type?: ArgumentType;method call
call: ( parser: ArgumentParser, namespace: Namespace, values: unknown, option_string?: string) => void;method format_usage
format_usage: () => string;call signature
( parser: ArgumentParser, namespace: Namespace, values: unknown, option_string?: string): void;interface ActionClass
interface ActionClass {}property prototype
readonly prototype: Action;construct signature
new (options: ActionConstructorOptions): Action;interface ActionConstructor
interface ActionConstructor extends ActionClass {}call signature
(options: ActionConstructorOptions): Action;interface ActionConstructorOptions
interface ActionConstructorOptions extends ArgumentOptions {}property dest
dest: string;property option_strings
option_strings: string[];interface ActionsContainer
interface ActionsContainer {}method add_argument
add_argument: { (name: string, ...names: string[]): Action; (name: string, ...namesAndOptions: [...string[], ArgumentOptions]): Action;};method get_default
get_default: (dest: string) => unknown;method register
register: (registry_name: string, value: unknown, object: unknown) => void;method set_defaults
set_defaults: (options: object) => void;interface ArgumentDefaultsHelpFormatter
interface ArgumentDefaultsHelpFormatter extends HelpFormatter {}interface ArgumentError
interface ArgumentError extends Error {}method str
str: () => string;interface ArgumentErrorConstructor
interface ArgumentErrorConstructor {}property prototype
readonly prototype: ArgumentError;construct signature
new (argument: Action | undefined, message: string): ArgumentError;call signature
(argument: Action | undefined, message: string): ArgumentError;interface ArgumentGroup
interface ArgumentGroup extends ActionsContainer {}method add_mutually_exclusive_group
add_mutually_exclusive_group: ( options?: MutuallyExclusiveGroupOptions) => MutuallyExclusiveGroup;interface ArgumentGroupOptions
interface ArgumentGroupOptions {}property argument_default
argument_default?: unknown;property conflict_handler
conflict_handler?: string;property description
description?: string;property prefix_chars
prefix_chars?: string;property title
title?: string;interface ArgumentOptions
interface ArgumentOptions {}property action
action?: string | ActionClass;property choices
choices?: string | readonly unknown[] | object;property const
const?: unknown;property default
default?: unknown;property deprecated
deprecated?: boolean;property dest
dest?: string;property help
help?: string;property metavar
metavar?: string | string[];property nargs
nargs?: Nargs;property option_strings
option_strings?: string[];property required
required?: boolean;property type
type?: ArgumentType;property version
version?: string;interface ArgumentParser
interface ArgumentParser extends ArgumentGroup {}property add_help
add_help: boolean;property allow_abbrev
allow_abbrev: boolean;property color
color: boolean;property description
description?: string;property epilog
epilog?: string;property exit_on_error
exit_on_error: boolean;property formatter_class
formatter_class: HelpFormatterFactory;property fromfile_prefix_chars
fromfile_prefix_chars?: string;property prog
prog: string;property suggest_on_error
suggest_on_error: boolean;property usage
usage?: string;method add_argument_group
add_argument_group: { (options?: ArgumentGroupOptions): ArgumentGroup; (title?: string, description?: string): ArgumentGroup;};method add_mutually_exclusive_group
add_mutually_exclusive_group: ( options?: MutuallyExclusiveGroupOptions) => MutuallyExclusiveGroup;method add_subparsers
add_subparsers: (options?: SubparserOptions) => SubparsersAction;method convert_arg_line_to_args
convert_arg_line_to_args: (arg_line: string) => string[];method error
error: (message: string) => void;method exit
exit: (status?: number, message?: string) => void;method format_help
format_help: () => string;method format_usage
format_usage: () => string;method parse_args
parse_args: <T extends object = Namespace>(args?: string[], namespace?: T) => T;method parse_intermixed_args
parse_intermixed_args: <T extends object = Namespace>( args?: string[], namespace?: T) => T;method parse_known_args
parse_known_args: <T extends object = Namespace>( args?: string[], namespace?: T) => [T, string[]];method parse_known_intermixed_args
parse_known_intermixed_args: <T extends object = Namespace>( args?: string[], namespace?: T) => [T, string[]];method print_help
print_help: (file?: Writable) => void;method print_usage
print_usage: (file?: Writable) => void;interface ArgumentParserClass
interface ArgumentParserClass {}property prototype
readonly prototype: ArgumentParser;construct signature
new (options?: ArgumentParserOptions): ArgumentParser;interface ArgumentParserConstructor
interface ArgumentParserConstructor extends ArgumentParserClass {}call signature
(options?: ArgumentParserOptions): ArgumentParser;interface ArgumentParserOptions
interface ArgumentParserOptions {}property add_help
add_help?: boolean;property allow_abbrev
allow_abbrev?: boolean;property argument_default
argument_default?: unknown;property color
color?: boolean;property conflict_handler
conflict_handler?: string;property description
description?: string;property epilog
epilog?: string;property exit_on_error
exit_on_error?: boolean;property formatter_class
formatter_class?: HelpFormatterFactory;property fromfile_prefix_chars
fromfile_prefix_chars?: string;property parents
parents?: ArgumentParser[];property prefix_chars
prefix_chars?: string;property prog
prog?: string;property suggest_on_error
suggest_on_error?: boolean;property usage
usage?: string;interface ArgumentTypeError
interface ArgumentTypeError extends Error {}interface ArgumentTypeErrorConstructor
interface ArgumentTypeErrorConstructor {}property prototype
readonly prototype: ArgumentTypeError;construct signature
new (message: string): ArgumentTypeError;call signature
(message: string): ArgumentTypeError;interface BooleanOptionalAction
interface BooleanOptionalAction extends Action {}interface BooleanOptionalActionConstructor
interface BooleanOptionalActionConstructor {}property prototype
readonly prototype: BooleanOptionalAction;construct signature
new (options: ActionConstructorOptions): BooleanOptionalAction;call signature
(options: ActionConstructorOptions): BooleanOptionalAction;interface FileType
interface FileType {}method call
call: (value: string) => FileTypeResult;call signature
(value: string): FileTypeResult;interface FileTypeConstructor
interface FileTypeConstructor {}property prototype
readonly prototype: FileType;construct signature
new (options?: FileTypeOptions): FileType;construct signature
new (flags?: string, encoding?: string, mode?: number): FileType;call signature
(options?: FileTypeOptions): FileType;call signature
(flags?: string, encoding?: string, mode?: number): FileType;interface FileTypeOptions
interface FileTypeOptions {}interface FileTypeResult
interface FileTypeResult {}interface HelpFormatter
interface HelpFormatter {}interface HelpFormatterClass
interface HelpFormatterClass {}property prototype
readonly prototype: HelpFormatter;construct signature
new (options: HelpFormatterOptions): HelpFormatter;interface HelpFormatterConstructor
interface HelpFormatterConstructor extends HelpFormatterClass {}call signature
(options: HelpFormatterOptions): HelpFormatter;interface HelpFormatterOptions
interface HelpFormatterOptions {}property color
color?: boolean;property indent_increment
indent_increment?: number;property max_help_position
max_help_position?: number;property prog
prog: string;property width
width?: number;interface MetavarTypeHelpFormatter
interface MetavarTypeHelpFormatter extends HelpFormatter {}interface MutuallyExclusiveGroup
interface MutuallyExclusiveGroup extends ActionsContainer {}interface MutuallyExclusiveGroupOptions
interface MutuallyExclusiveGroupOptions {}property required
required?: boolean;interface Namespace
interface Namespace {}index signature
[key: string]: any;interface NamespaceConstructor
interface NamespaceConstructor {}property prototype
readonly prototype: Namespace;construct signature
new (options?: object): Namespace;call signature
(options?: object): Namespace;interface RawDescriptionHelpFormatter
interface RawDescriptionHelpFormatter extends HelpFormatter {}interface RawTextHelpFormatter
interface RawTextHelpFormatter extends RawDescriptionHelpFormatter {}interface SubArgumentParserOptions
interface SubArgumentParserOptions extends ArgumentParserOptions {}property aliases
aliases?: string[];property deprecated
deprecated?: boolean;property help
help?: string;interface SubparserOptions
interface SubparserOptions {}property action
action?: string | ActionClass;property description
description?: string;property dest
dest?: string;property help
help?: string;property metavar
metavar?: string;property parser_class
parser_class?: ArgumentParserClass;property prog
prog?: string;property required
required?: boolean;property title
title?: string;interface SubparsersAction
interface SubparsersAction extends Action {}method add_parser
add_parser: (name: string, options?: SubArgumentParserOptions) => ArgumentParser;Type Aliases
type ArgumentType
type ArgumentType = | string | ((value: string) => unknown) | (new (value: string) => unknown);type HelpFormatterFactory
type HelpFormatterFactory = | HelpFormatterClass | ((options: HelpFormatterOptions) => HelpFormatter);type Nargs
type Nargs = number | '?' | '*' | '+' | 'A...' | '...' | '==SUPPRESS==';Package Files (1)
Dependencies (0)
No dependencies.
Dev Dependencies (2)
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/argparse.
- Markdown[](https://www.jsdocs.io/package/argparse)
- HTML<a href="https://www.jsdocs.io/package/argparse"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 3942 ms. - Missing or incorrect documentation? Open an issue for this package.
