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

Related tags

CLI Tools akparse
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
Ssl-tool - A simple interactive CLI wrapper around openssl to make creation and installation of self-signed certs easy

What's this? A simple interactive CLI wrapper around openssl to make self-signin

Aniket Teredesai 9 May 17, 2022
Sink is a CLI tool that allows users to synchronize their local folders to their Google Drives. It is similar to the Git CLI and allows fast and reliable syncs with the drive.

Sink is a CLI synchronisation tool that enables a user to synchronise local system files and folders with their Google Drives. It follows a git C

Yash Thakre 16 May 29, 2022
[WIP]An ani-cli like cli tool for movies and webseries

mov-cli A cli to browse and watch movies. Installation This project is a work in progress. However, you can try it out python git clone https://github

null 166 Dec 30, 2022
Hack-All is a simple CLI tool that helps ethical-hackers to make a reverse connection without knowing the target device in use is it computer or phone

Hack-All is a simple CLI tool that helps ethical-hackers to make a reverse connection without knowing the target device in use is it computer

LightYagami17 5 Nov 22, 2022
Simple CLI prompt for easy I/O with OpenAI's API

openai-cli-prompt Simple CLI prompt for easy I/O with OpenAI's API Quickstart Create a .env file with: OPENAI_API_KEY=<Your OpenAI API Key> Configure

Erik Nomitch 1 Oct 12, 2021
flora-dev-cli (fd-cli) is command line interface software to interact with flora blockchain.

Install git clone https://github.com/Flora-Network/fd-cli.git cd fd-cli python3 -m venv venv source venv/bin/activate pip install -e . --extra-index-u

null 14 Sep 11, 2022
AWS Interactive CLI - Allows you to execute a complex AWS commands by chaining one or more other AWS CLI dependency

AWS Interactive CLI - Allows you to execute a complex AWS commands by chaining one or more other AWS CLI dependency

Rafael Torres 2 Dec 10, 2021
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 5, 2021
Yts-cli-streamer - A CLI movie streaming client which works on yts.mx API written in python

YTSP It is a CLI movie streaming client which works on yts.mx API written in pyt

null 1 Feb 5, 2022