Naked: A Command Line Application Framework

0.1.32 · active · verified Sun Apr 12

Naked is a MIT licensed Python command line application framework that is currently in development, described as an 'early stable testing version'. It provides an executable for project generation, testing, profiling, and distribution to PyPI, alongside a Python library featuring an easy-to-use command-line string object parser and numerous Python type/method/function extensions. The current version is 0.1.32, released on November 6, 2022. The project maintains an active status with ongoing development, though users are advised to anticipate potential breaking changes.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates parsing command-line arguments using `Naked.commandline.Command`. It simulates command-line input and checks for a primary command ('hello'), a secondary command ('world'), and an option ('--print').

import sys
from Naked.commandline import Command

# Simulate command-line arguments for demonstration
# In a real application, sys.argv would be populated by the shell.
# For example, to run this: python your_script.py hello world --print
sys.argv = ['your_script.py', 'hello', 'world', '--print']

c = Command(sys.argv[0], sys.argv[1:])

if c.cmd == 'hello' and c.cmd2 == 'world':
    if c.option('--print'):
        print('Hello World from Naked!')
    else:
        print('Hello World (without --print) from Naked!')
else:
    print('Invalid command. Try: hello world --print')

view raw JSON →