Skip to main content

Create Console Option Dictionary

Project description

consoleoptions

option rules

Writing the console command options with the following rules will create a option value dictionary.

frag

  • if the option key exists, 'True' value will set on the dictionary.
  dictionary[key] = True

For Example,

  % command.py optionfrag

Then,

  dictionary['optionfrag'] => True
  'optionfrag' in dictionary => True

key-value

  • The option key and the value are connected with '=' character, they will set as a key-value on the dictionary.
  dictionary[key] = value

For Example,

  % command.py optionkey='value'

or,

  % command.py optionkey="value"

or,

  % command.py optionkey=value

Then,

  dictionary['optionkey'] => value
  'optionkey' in dictionary => True

key-value list

  • The option key-value are connected with '=' character and the value is comma separated list, they will set as a key-value_list on the dictionary.
  dictionary[key] = [value1,value2,value3,...]

For Example,

  % command.py optionkey='value1,value2,value3'

or,

  % command.py optionkey="value1,value2,value3"

or,

  % command.py optionkey=value1,value2,value3

Then,

  dictionary['optionkey'] => [value1,value2,value3]
  'optionkey' in dictionary => True
  type(dictionary['optionkey']) => <class 'list'>

methods

get_dict

Parse space separated argument.

When the key ends with particular word, the paired value will be parsed using following rules automatically.

word key-value key-value_list
__int int(value) [int(value1), int(value2), ...]
__double float(value) [float(value1), float(value2), ...]

Use 'dict' to set the default values.

load_from_file

Parse options from file.

Use 'dict' to set the default values.

load_from_json

Parse options from json format.

Use 'dict' to set the default values.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

consoleoptions-1.1.0.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

consoleoptions-1.1.0-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file consoleoptions-1.1.0.tar.gz.

File metadata

  • Download URL: consoleoptions-1.1.0.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.5.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

File hashes

Hashes for consoleoptions-1.1.0.tar.gz
Algorithm Hash digest
SHA256 06e2a96ac3c0849d0add28eb8c8c19f3f5f9d938bd37527df5c63f9bd67f35d0
MD5 308109935695e778d431166153975b07
BLAKE2b-256 e1e15caa79f700fbbe94d069e877373830cdccde67763e2452b0cb2b6d76c81d

See more details on using hashes here.

File details

Details for the file consoleoptions-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: consoleoptions-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.5.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

File hashes

Hashes for consoleoptions-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2f45d68920bd97f83c58a7113602f1c66c9b2cfac440e58e247e508178326a2a
MD5 d9511b8759cbf62ed47bc045f13ca797
BLAKE2b-256 c12e2c34d7c6ce9c07128683a629edfac224928844f0cdae1bd9a7b2af6776a7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page