Skip to content

A python CLI framework base on argparse, supporting: config system, command-completion, rich-text log, friendly help message prompt and so on.

License

Notifications You must be signed in to change notification settings

sean2077/pyclier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pyclier

A python CLI framework base on argparse, supporting: config system, command-completion, rich-text log, friendly help message prompt and so on.

Note: This project was created with Cookiecutter and the zhangxianbing/cookiecutter-pypackage project template.

Features

  • support friendly help message prompt
  • support configuration file parsing system
  • support easy-to-use interface for building complex CLI program
  • support rich-text and flexible log system (base on rich)
  • support command auto-completion (base on argcomplete)
  • support auto generating and updating usage (based on auto-usage)
  • support updating CLI program

Quick Start

Installation

pip install pyclier

For using auto completion, you should first install argcomplete and the activate it:

pip install argcomplete
activate-global-python-argcomplete

Then add the following lines in your setup.py:

from setuptools import setup

setup(...)

# post installation

from pyclier.setuptools import copytree, enable_complete

command = sys.argv[-1]
if command == "install":
    copytree("conf", appdirs.user_config_dir(prog_name))
    enable_complete(prog_name)

    import pip

    pip.main(["install", ".", "-U", "--no-index"])

Run demo

cd pyclier-demo && make install
# then refresh your bash environment
pyclier -h

About

A python CLI framework base on argparse, supporting: config system, command-completion, rich-text log, friendly help message prompt and so on.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published