A simple and easy-to-use CLI parse tool.

Overview

akparse package

A simple and easy-to-use CLI parse tool package. You can use '-', '--', ',', '|', '{', '}', '[', ']', '=' and character to define your CLI API and the constraints are as follows:

  • '-' : indicate a short option, followed by a character usually.
  • '--': indicate a long option, followed by a word usually.
  • ',' : indicate a required option of one CLI API defined.
  • '|' : indicate a parallel option of one CLI API defined with same prefix.
  • '{}': indicate the parallel option, always with '|' together.
  • '[]': indicate the optional option.
  • '=' : indicate the k-v option.

eg, one disk-file API:

# create a disk file when be defined: --create,-p=[--user=,-a=]
disk-file --create -p file_path
disk-file --create -p file_path --user u1 -a 777

# query a disk file  when be defined: --query[{-p=|--list}]
disk-file --query
disk-file --query -p file_path
disk-file --query --list

usage

import sys

from akparse.parsers import AkParser
from akparse.utils.ak_echo import AkEcho
from akparse.errs.ak_error import AkError

flag_name = None
flag_options = None

try:
    file_parser = AkParser()
    file_parser.add("help", "{-h|--help}")
    file_parser.add("file_create", "--create,-p=[--user=,-a=]")
    file_parser.add("file_query", "--query[{-p=|--list}]")
    file_parser.add("file_set", "--set{-p=,--user=,-a=|--limit=}")
    file_parser.add("file_delete", "--delete,-p=[--user=]")
    file_parser.add("file_status", "--status")
    flag_name, flag_options = file_parser.parse(sys.argv[1:])
except AkError as err:
    AkEcho.ak_err(AkError.ERROR_PARSE_MSG + err.msg)

# Print parse result
AkEcho.ak_echo(flag_name)
AkEcho.ak_echo(flag_options)

Please see more detail usage in examples

Install

This package is also released to PyPi.org. View at https://pypi.org/project/akparse/

pip install akparse
You might also like...
Dead simple CLI tool to try Python packages - It's never been easier! :package:
Dead simple CLI tool to try Python packages - It's never been easier! :package:

try - It's never been easier to try Python packages try is an easy-to-use cli tool to try out Python packages. Features Install specific package versi

Simple CLI tool to track your cryptocurrency portfolio in real time.
Simple CLI tool to track your cryptocurrency portfolio in real time.

Simple tool to track your crypto portfolio in realtime. It can be used to track any coin on the BNB network, even obscure coins that are not listed or trackable by major portfolio tracking applications.

A simple cli tool to commit Conventional Commits

convmoji A simple cli tool to commit Conventional Commits. Requirements Install pip install convmoji convmoji --help Examples A conventianal commit co

A simple CLI tool for tracking Pikud Ha'oref alarms.
A simple CLI tool for tracking Pikud Ha'oref alarms.

Pikud Ha'oref Alarm Tracking A simple CLI tool for tracking Pikud Ha'oref alarms. Polls the unofficial API endpoint every second for incoming alarms.

A simple Python CLI tool that draws routes/paths on a given map.

Map Router A simple Python CLI tool that draws routes/paths on a given map. Index Installation Usage Docs Why? License Support Installation Coming soo

A Simple Python CLI Lockpicking Tool

Cryptex a simple CLI lockpicking tool What can it do: Encode / Decode Hex Encode / Decode Base64 Break Randomly :D Requirements: Python3 Linux as your

Proman is a simple tool for managing projects through cli.

proman proman is a project manager. It helps you manage your projects from a terminal. The features are listed below. Installation Step 1: Download or

A simple CLI tool for getting region-specific status of Logz.io components.

About A simple CLI tool for checking the current status of Logz.io components per region. Built With Python 3 The following packeges (see requirements

Notion-cli-list-manager - A simple command-line tool for managing Notion databases

A simple command-line tool for managing Notion List databases. ✨

Releases(v0.1.8)
Owner
AbsentM
CS & SE
AbsentM
Collection of useful command line utilities and snippets to help you organise your workspace and improve workflow.

Collection of useful command line utilities and snippets to help you organise your workspace and improve workflow.

Dominik Tarnowski 3 Dec 26, 2021
tiptop is a command-line system monitoring tool in the spirit of top.

Command-line system monitoring. tiptop is a command-line system monitoring tool in the spirit of top. It displays various interesting system stats, gr

Nico Schlömer 1.3k Jan 08, 2023
Python-Stock-Info-CLI: Get stock info through CLI by passing stock ticker.

Python-Stock-Info-CLI Get stock info through CLI by passing stock ticker. Installation Use the following command to install the required modules at on

Ayush Soni 1 Nov 05, 2021
An open source terminal project made in python

Calamity-Terminal An open source terminal project made in python. Calamity Terminal is a free and open source lightweight terminal. Its made 100% off

1 Mar 08, 2022
A simple command line tool for changing the icons of folders or files on MacOS.

Mac OS File Icon Changer Description A small and simple script to quickly change large amounts or a few files and folders icons to easily customize th

Eroxl 3 Jan 02, 2023
Unpacks things.

$ unp_ unp is a command line tool that can unpack archives easily. It mainly acts as a wrapper around other shell tools that you can find on v

Armin Ronacher 405 Jan 03, 2023
triggercmd is a CLI client for the TRIGGERcmd cloud service.

TriggerCMD CLI client triggercmd is a CLI client for the TRIGGERcmd cloud service. installation the triggercmd package is available in PyPI. to instal

Gustavo Soares 7 Oct 18, 2022
📦 A command line utility to put text in a box.

boxie A command line utility to put text in a box. Installation pip install boxie If you are on Linux you may need to use sudo to access this globally

Eliaz Bobadilla 10 Jun 30, 2022
CLI helper to install Github releases on your system.

gh-release-install is a CLI helper to install Github releases on your system. It can be used for pretty much anything, to install a formatter in your CI, deploy some binary using an orcherstration to

Jonas L. 28 Nov 06, 2022
🐾 Get the nftables counters easier to read

nft-stats Get the nftables counters easier to read It kind of hard to read the output of nft list ruleset so there is a small program parcising the ou

7 Oct 08, 2022
TUIFIManager - A cross-platform terminal-based file manager

TUIFI Manager A cross-platform terminal-based file manager (and component), mean

142 Dec 26, 2022
Zecwallet-Python is a simple wrapper around the Zecwallet Command Line LightClient written in Python

A wrapper around Zecwallet Command Line LightClient, written in Python Table of Contents About Installation Usage Examples About Zecw

Priveasy 2 Sep 06, 2022
Cli tool to browse and play anime

browse and watch anime (scrape from gogoanime) (wip) basically ani-cli but in python cuz python good demo dependencies mpv installation from pypi pip

sheep padowo 2 Apr 20, 2022
Urial (URI Addition tooL) intelligently updates URIs stored in Finder comments of macOS files

Urial Urial (URI addition tool) is a simple but intelligent command-line tool to add or replace URIs found inside macOS Finder comments. Table of cont

Mike Hucka 3 Sep 14, 2022
A Terminal Client for MySQL with AutoCompletion and Syntax Highlighting.

mycli A command line client for MySQL that can do auto-completion and syntax highlighting. HomePage: http://mycli.net Documentation: http://mycli.net/

dbcli 10.7k Jan 07, 2023
A simple CLI based any Download Tool, that find files and let you stream or download thorugh WebTorrent CLI or Aria or any command tool

Privateer A simple CLI based any Download Tool, that find files and let you stream or download thorugh WebTorrent CLI or Aria or any command tool How

Shreyash Chavan 2 Apr 04, 2022
🐍The nx-python plugin allows users to create a basic python application using nx commands.

🐍 NxPy: Nx Python plugin This project was generated using Nx. The nx-python plugin allows users to create a basic python application using nx command

StandUP Communications 74 Aug 31, 2022
Features terminal for python

Features Terminal V1.0 (23/10/2021) Um programa para linux com diferentes ferramentas! Recursos: Criador de QR code Gerador de senhas Teste de velocid

1 Oct 26, 2021
Personal and work vim 8 configuration with submodules

vimfiles Windows Vim 8 configuration files based on the recommendations of Ruslan Osipov, Keep Your vimrc file clean and The musings of bluz71. :help

1 Aug 27, 2022
A minimal and ridiculously good looking command-line-interface toolkit.

Pyceo Pyceo is a Python package for creating beautiful, composable, and ridiculously good looking command-line-user-interfaces without having to write

Juan-Pablo Scaletti 21 Mar 25, 2022