Coder Social home page Coder Social logo

eshaan7 / click-creds Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 4.0 36 KB

Pluggable credentials storage and management for click CLI apps

Home Page: https://pypi.org/project/click-creds/

License: BSD 3-Clause "New" or "Revised" License

Python 100.00%
click python-click python-cli cli auth netrc netrc-creds creds credentials credential-storage

click-creds's Introduction

click-creds

pypi Build Status codecov CodeFactor Language grade: Python

Pluggable credentials storage and management for click CLI applications.

Uses ~/.netrc file method which is used by popular CLI applications like Heroku CLI, AWS CLIs, etc.

Installation

Requires python version >=3.6.

$ pip install click-creds

Quickstart

Here's an example cli.py file.

#!/usr/bin/env python3
import click
import click_creds

@click.group(context_settings=dict(help_option_names=["-h", "--help"]))
@click_creds.use_netrcstore(
    name="myawesomeapp",
    mapping={"login": "username", "password": "api_key", "account": "url"},
)
def cli():
    pass

# Register "config" group
cli.add_command(click_creds.config_group)

# Entrypoint
if __name__ == "__main__":
    cli()

Now, if we execute ./cli.py config,

$ ./cli.py config
Usage: cli.py config [OPTIONS] COMMAND [ARGS]...

  Set or view config variables

Options:
  -h, --help  Show this message and exit.

Commands:
  get  Echo config variables
  set  Update config variables

Documentation

Please see the example_project.

Changelog / Releases

All releases should be listed in the releases tab on GitHub.

See CHANGELOG for a more detailed listing.

License

This project is published with the BSD License. See https://choosealicense.com/licenses/bsd/ for more information about what this means.

Credits

click-creds's People

Contributors

deepsource-autofix[bot] avatar deepsource-io[bot] avatar deepsourcebot avatar eshaan7 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

click-creds's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.