Skip to main content
Latest Version Downloads License

Cliar (pronounced as “clear”) helps you create command-line interfaces with minimum code:

from cliar import CLI

class Git(CLI):
    '''Git clone created with Cliar'''

    def clone(self, repo, dir='.'):
        '''Clone a git repo from REPO to DIR.'''

        print('Cloning from %s to %s' % (repo, dir))

if __name__ == '__main__':
    Git().parse()

Run the script:

$ python git.py clone http://foo.bar -d baz
Cloning from http://foo.bar to baz

Read the docs at cliar.rtfd.org

Requirements

Cliar runs with Python 2.6, 2.7, and 3.3+ on Windows, Linux, and Mac with not third party dependencies.

Install

Install Cliar from PyPI with pip:

$ pip install cliar

Why another CLI tool?

I know there’re great projects like docopt and click out there. Before creating Cliar, I tried them both.

Long story short, neither click, not docopt allow for easily extendible CLIs. Cliar lets you extend your CLI with simple subclassing.

By extendability I mean the ability to extend CLI defined in one module with commands from another module.

In docopt, this would mean overriding the entire help string or inserting a line into it, which is neither elegant, nor flexible, nor stable.

In click, commands are just functions in the global namespace, and nesting is done with the group decorator. Extending can be done with importing * from one module to another, which is bad practice. Putting the commands inside a class doesn’t work as expected, which makes it impossible to extend CLI with subclassing.

Limitations

Cliar is designed to help you create CLIs quickly and with as little code as possible. For the sake of simplicity, some features are not available:

  • You can’t add help text for arguments. You can though add help text for commands via docstrings.

  • Optional arguments are given in the form “-name, “ which is unconvential, however valid. You can abbreviate optional arguments until it’s unambiguous.

  • No third level commands.

  • Generally speaking, Cliar can’t do a lot of things argparse can, but the idea is that you probably don’t need most of these things.

Contribute

Report a bug

Fork and improve

Metadata

Release files for cliar 1.0.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cliar 1.0.9
File Size Uploaded
cliar-1.0.9.zip 8.5 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for cliar 1.0.9
File Interpreter ABI Platform
cliar-1.0.9.win-amd64.exe Details
cliar-1.0.9-py3-none-any.whl Python 3 none any Details

Total release size: 159.5 kB

Release files / cliar-1.0.9.zip

Download URL cliar-1.0.9.zip
Size 8.5 kB
Tags Source
SHA-256 checksum
How to use checksums
75db7114994bdb525aaad2f4e0d30ebed4ec58424caf919a836b20fc5b2e0977
BLAKE2b-256 checksum
How to use checksums
5e9cfbb6ccd29f7a2c3d2e37bbac0f9e11c284581c813e18e51ebfffecaf88f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / cliar-1.0.9.win-amd64.exe

Download URL cliar-1.0.9.win-amd64.exe
Size 144.3 kB
Tags Source
SHA-256 checksum
How to use checksums
c3e93914b7ff81a9c041e60d42ce071e36a7957e72432696f3a4ff58291a2703
BLAKE2b-256 checksum
How to use checksums
325249bd64d2222b3a508f7f9d51f35e45df4ac906341c56c6ca31c513866473
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / cliar-1.0.9-py3-none-any.whl

Download URL cliar-1.0.9-py3-none-any.whl
Size 6.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d93b0cc87a287c94ad8ea2722ccc8e0b4bc3cfe16965cbce454a07073f77fffb
BLAKE2b-256 checksum
How to use checksums
b610b71314eb62a333a77c786308283790a16f9d9d1a1978d063880c85bc44c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

1.3.5

2 release files

1.3.4

2 release files

1.3.3

2 release files

1.3.2

2 release files

1.3.0

2 release files

1.2.5

2 release files

1.2.4

2 release files

1.2.3

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.9

2 release files

1.1.8

2 release files

1.1.7

2 release files

1.1.6

2 release files

1.1.5

2 release files

1.1.4

2 release files

1.1.3

3 release files

1.1.2

2 release files

1.1.1

3 release files

1.1.0

3 release files

This release

1.0.9 This release

3 release files

1.0.8

3 release files

1.0.7

3 release files

1.0.6

3 release files

1.0.5

3 release files

1.0.4

3 release files

1.0.3

3 release files

1.0.2

3 release files

1.0.1

3 release files

1.0.0

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page