Skip to main content

Installation

pip install -U cmdu

build

pip install -r requirements.txt
rm -rf dist
python -m build
python -m twine upload dist/* -u __token__ -p {token}

Commands

|-- cmdu
|   |-- file-mod
|   |   |-- hosts
|   |   |   |-- add
|   |   |   |-- delete
|   |   |   |-- delete-all
|   |
|   |-- check-list
|   |   |-- create
|   |   |-- check
|   |   |-- uncheck
|   |
|   |-- lnes
|   |   |-- set-nu
|   |   |-- count
|   |   |-- trim
|   |   |-- split
|   |   |-- skip
|   |   |-- filter
|   |   |-- filter-not
|   |
|   |-- convert
|   |   |-- j2j
|   |   |-- j2y
|   |   |-- y2j
|   |

file-mod hosts add

add a host to specific ip

# input
127.0.0.1 abc.com

python -m cmdu file-mod hosts add -ip 127.0.0.1 -host abcx.com

# output
127.0.0.1 abc.com abcx.com

file-mod hosts delete

delete a host from specific ip

# input
127.0.0.1 abc.com abcx.com

python -m cmdu file-mod hosts delete -ip 127.0.0.1 -host abcx.com

# output
127.0.0.1 abc.com

file-mod hosts delete-all

delete all hosts from specific ip

# input
127.0.0.1 abc.com
127.0.0.2 abcx.com

python -m cmdu file-mod hosts delete-all -ip 127.0.0.2

# output
127.0.0.2 abcx.com

check-list create

create line by line record to check list

# input
line 1
line 2

line 3

python -m cmdu check-list create

# output
[ ] 000001 |line 1
[ ] 000002 |line 2

[ ] 000003 |line 3

check-list load

load check list from different format (simple, json, yaml) into other format (simple, json, yaml)

# input
[ ] 000001 |line 1
[x] 000002 |line 2

[X] 000003 |line 3

python -m cmdu check-list --simple-in --yaml-out

# out
- checked: false
  id: '000001'
  line: item 1
- checked: true
  id: '000002'
  line: item 2
- checked: true
  id: '000003'
  line: item 3

check-lst check

check the item by number

# input
[ ] 000001 |line 1
[ ] 000002 |line 2

[ ] 000003 |line 3

python -m cmdu check-list check 2 3

# out
[ ] 000001 |line 1
[X] 000002 |line 2

[X] 000003 |line 3

check-lst uncheck

uncheck the item by number

# input
[ ] 000001 |line 1
[x] 000002 |line 2

[X] 000003 |line 3

python -m cmdu check-list check 1 2 3

# out
[ ] 000001 |line 1
[ ] 000002 |line 2

[ ] 000003 |line 3

lines set-nu

set line number to each line, pad 000000 | to the left

  1. python -m cmdu lines set-nu
    # input
    line 1
    line 2
    
    # output
    000001 |line 1
    000002 |line 2
    

lines count

Count the number of lines

  1. python -m cmdu lines count
    # input
    line 1
    line 2
    
    # output
    2
    

lines trim

Trim the line by delimiter

  1. Trim right
    # input
    xline 1x
    bline 2b
    xline 3x
    
    python -m cmdu lines trim --right -c x
    
    # output
    xline 1
    bline 2b
    xline 3
    
  2. Trim left
    # input
    xline 1x
    bline 2b
    xline 3x
    
    python -m cmdu lines trim --left -c x
    
    # output
    line 1x
    bline 2b
    line 3x
    
  3. Trim both side
# input
xline 1x
bline 2b
xline 3x

python -m cmdu lines trim --both -c x

# output
line 1
bline 2b
line 3

lines split

Split the line by delimiter

# input
a, b, c

python -m cmdu lines split --d ","

# output
a
b
c

lines skip

Skip the first n lines

  1. python -m cmdu lines skip 2
    # input
    line 1
    line 2
    line 3
    
    # output
    line 3
    

lines filter

Filter any match line

  1. filter by regex, any matching in regex will make the whole line accepted
    # input
    line 1
    line 2
    line 3
    
    python -m cmdu filter --regex "^line 1$"
    
    # output
    line 1
    

lines filter not

Filter any not match line

  1. filter by regex, any matching in regex will make the whole line rejected
    # input
    line 1
    line 2
    line 3
    
    python -m cmdu filter-not --regex "^line 1$"
    
    # output
    line 2
    line 3
    

convert j2j

convert a json input (from stdin) as json output (to stdout)

  1. with raw json(no indentation and new line) python -m cmdu json2json
    # input
    {"a": 1, "b": 2}
    
    python-m cmdu json2json
    
    # output
    {"a": 1, "b": 2}
    
  2. with pretty format python -m cmdu json2json --pretty
    # input
    {"a": 1, "b": 2}
    
    python-m cmdu json2json --pretty
    
     # output
     {
         "a": 1,
         "b": 2
     }
    
  3. with pretty format and indentation as 2 python -m cmdu json2json --pretty --indent 2
    # input
    {"a": 1, "b": 2}
    
    python-m cmdu json2json --pretty --indent 2
    
    # output
    {
      "a": 1,
      "b": 2
    }
    

convert j2y

convert a json input (from stdin) as yaml output (to stdout)

  1. with json as yaml
    # input
    {"a": 1, "b": 2}
    
    python-m cmdu j2y
    
    # output
    a: 1
    b: 2
    

convert y2j

convert a yaml input (from stdin) as json output (to stdout)

  1. with raw json
    # input
    a: 1
    b: 2
    
    python-m cmdu y2j
    
    # output
    {"a": 1, "b": 2}
    
  2. with pretty format python -m cmdu yaml2json --pretty
    # input
    a: 1
    b: 2
    
    python -m cmdu yaml2json --pretty
    
    # output
    {
         "a": 1,
         "b": 2
    }
    
  3. with pretty format and indentation as 2 python -m cmdu yaml2json --pretty --indent 2
    # input
    a: 1
    b: 2
    
    python -m cmdu yaml2json --pretty --indent 2
    
    # output
    {
       "a": 1,
       "b": 2
    }
    

Metadata

Release files for cmdu 0.0.15

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cmdu 0.0.15
File Size Uploaded Provenance Actions
cmdu-0.0.15.tar.gz 2.4 MB Without provenance Details for cmdu-0.0.15.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cmdu 0.0.15
File Interpreter ABI Platform Actions
cmdu-0.0.15-py3-none-any.whl Python 3 none any Details for cmdu-0.0.15-py3-none-any.whl

Total release size: 2.4 MB

Release files / cmdu-0.0.15.tar.gz

Download URL cmdu-0.0.15.tar.gz
Size 2.4 MB
Tags Source
SHA-256 checksum
How to use checksums
dde4c50d003308e4e2880c1ee263281f58d7f8fdd5bb528cbbf45e9bb8a63561
BLAKE2b-256 checksum
How to use checksums
46e972ee9106adce01b586f01e40cac39a42c05c3231112f70e19810ddb11c14
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.12

Release files / cmdu-0.0.15-py3-none-any.whl

Download URL cmdu-0.0.15-py3-none-any.whl
Size 9.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d274c631488dcf4028ba94350bfc3d04ae922f3a76f5ceeb9d1869eab248c82d
BLAKE2b-256 checksum
How to use checksums
5d2f737fb96278d31fb7f5ca88612ae13f620d7ebf2101ab1cecbf2a73b7eaf9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.12

Security for cmdu 0.0.15

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page