https://github.com/eshaan7/click-creds
Pluggable credentials storage and management for click CLI apps
https://github.com/eshaan7/click-creds
auth cli cli-configuration click credential-manager credential-storage credentials creds heroku-cli netrc netrc-creds python python-authentication python-cli python-click
Last synced: 2 months ago
JSON representation
Pluggable credentials storage and management for click CLI apps
- Host: GitHub
- URL: https://github.com/eshaan7/click-creds
- Owner: eshaan7
- License: bsd-3-clause
- Created: 2020-12-23T13:14:03.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-10-03T13:05:56.000Z (over 1 year ago)
- Last Synced: 2025-03-19T04:12:57.710Z (2 months ago)
- Topics: auth, cli, cli-configuration, click, credential-manager, credential-storage, credentials, creds, heroku-cli, netrc, netrc-creds, python, python-authentication, python-cli, python-click
- Language: Python
- Homepage: https://pypi.org/project/click-creds/
- Size: 35.2 KB
- Stars: 4
- Watchers: 1
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# click-creds
[](https://pypi.org/project/click-creds/)
[](https://github.com/Eshaan7/click-creds/actions?query=workflow%3A%22Linter+%26+Tests%22)
[](https://codecov.io/gh/Eshaan7/click-creds)
[](https://www.codefactor.io/repository/github/eshaan7/click-creds)
![]()
Pluggable credentials storage and management for [click](https://github.com/pallets/click/) CLI applications.
Uses [`~/.netrc` file method](https://www.mkssoftware.com/docs/man4/netrc.4.asp) which is used by popular CLI applications like [Heroku CLI](https://devcenter.heroku.com/articles/authentication#netrc-file-format), AWS CLIs, etc.
## Installation
Requires python version `>=3.6`.
```bash
$ pip install click-creds
```## Quickstart
Here's an example `cli.py` file.
```python
#!/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`,
```bash
$ ./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`](https://github.com/Eshaan7/click-creds/tree/main/example_project).
## Changelog / Releases
All releases should be listed in the [releases tab on GitHub](https://github.com/Eshaan7/click-creds/releases).
See [CHANGELOG](https://github.com/Eshaan7/click-creds/blob/main/.github/CHANGELOG.md) for a more detailed listing.
## License
This project is published with the [BSD License](LICENSE). See [https://choosealicense.com/licenses/bsd/](https://choosealicense.com/licenses/BSD/) for more information about what this means.
## Credits
- [tinynetrc](https://github.com/sloria/tinynetrc)