New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

betterargs

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

betterargs

A tool to create a command-line interface for your app using python

  • 0.0.3
  • PyPI
  • Socket score

Maintainers
1

betterargs

A tool to create a command-line interface for your app using python

Installation

  • Requirements
    • python3.10
    • pip3
pip install betterargs

Releases

Packaging and releases are handled in the packaging branch.

MAIN BRANCH IS RESERVED FOR MAINTAINING CODE ONLY!!!

Usage

  • Create a command string in YAML format in a:

    1. YAML file
    2. Python dictionary
    3. Python string
  • Convert the yaml file to command line namespace using appropriate function

1. Using a YAML file

# Create command tree in a yaml file

git:
    args:
        path:
            atype: flag
            help: Path of the repo
    subparsers:
        parsers:
            clone:
                args:
                    quiet-clone:
                        atype: flag
                        help: Operate quietly. Progress is not reported to the standard error stream.
                    no-checkout:
                        help: No checkout of HEAD is performed after the clone is complete
            init:
                args:
                    quiet-init:
                        atype: flag
                        help: Operate quietly. Progress is not reported to the standard error stream.
# Import betterargs
import betterargs


# Create command line namespace and get arguments
command_tree_PATH = 'command_tree.yaml'

args = betterargs.format_path_tree(command_tree_PATH)

2. Using Python Dictionary in YAML Format

# Import betterargs
import betterargs


# Define command tree in a dictionary in YAML format
command_tree_DICT = {
    "git": {
        "args": {
            "path": {
                "atype": "flag",
                "help": "Path of the repo",
            },
        },
        "subparsers": {
            "parsers": {
                "clone": {
                    "args": {
                        "quiet-clone": {
                            "atype": "flag",
                            "help": "Operate quietly. Progress is not reported to the standard error stream.",
                        },
                        "no-checkout": {
                            "help": "No checkout of HEAD is performed after the clone is complete"
                        },
                    },
                },
                "init": {
                    "args": {
                        "quiet-init": {
                            "atype": "flag",
                            "help": "Operate quietly. Progress is not reported to the standard error stream.",
                        },
                    },
                },
            },
        },
    },
}


# Create command line namespace and get arguments
args = betterargs.format_dict_tree(command_tree_DICT)

3. Using string in YAML Format

# Import betterargs
import betterargs


# Define command tree in a string in YAML format
command_tree_STR = """
git:
    args:
        path:
            atype: flag
            help: Path of the repo
    subparsers:
        parsers:
            clone:
                args:
                    quiet-clone:
                        atype: flag
                        help: Operate quietly. Progress is not reported to the standard error stream.
                    no-checkout:
                        help: No checkout of HEAD is performed after the clone is complete
            init:
                args:
                    quiet-init:
                        atype: flag
                        help: Operate quietly. Progress is not reported to the standard error stream.
"""


# Create command line namespace and get arguments
args = betterargs.format_str_tree(command_tree_STR)

Contributors

Contribution

You are more than welcome to contribute 😊

Process

It's simple!!!

  • Fork the github repo

  • Clone the github repo

git clone https://github.com/danielmuringe/betterargs
  • Make your modifications in the dev branch

  • Merge into main branch respecting the .gitignore of the main branch. KEEP IT CLEAN PLEASE !!!

  • Create pull request

  • Wait for confirmation

Rules

  1. Active changes must take place in the dev branch. Active changes include:

  2. Tests must be put in the testing directory of dev branch

  3. All packaging must be done in the packaging branch

Other rules will be added at my discretion

Tests

Documentation

Coming Soon 😊

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc