Start here if you want to use the CLI to manage your YadaCoin node.
- QUICKSTART.md - Quick reference and common workflows
- README.md - Complete user documentation with all options
Start here if you want to extend the CLI or add new commands.
- DEVELOPMENT.md - Step-by-step guide to adding new commands
- README.md - See "Architecture" and "Adding New Commands" sections
cli/
├── INDEX.md # This file
├── QUICKSTART.md # User quick reference
├── README.md # Full user documentation
├── DEVELOPMENT.md # Developer guide
├── cli.py # Main entry point
├── __init__.py # Package marker
└── commands/
├── __init__.py
└── config/
├── __init__.py
├── config_base.py # Base class for config updaters
└── update_username.py # Username updater implementation
Subcommands: set-username
Configuration file management commands.
Update the node's username and recalculate its signature.
# Interactive mode
python3 cli/cli.py config set-username -u "my-node"
# Non-interactive mode
python3 cli/cli.py config set-username -u "my-node" --confirm-backup
# Custom config path
python3 cli/cli.py config set-username -u "my-node" \
-c /etc/yadacoin/config.json --confirm-backupOptions:
-u, --username(required): New username-c, --config(optional): Path to config.json (default:config/config.json)--confirm-backup(optional): Skip interactive confirmation
-
To use the CLI:
python3 cli/cli.py config set-username -u "my-node"Read QUICKSTART.md for more examples.
-
To add a new command: Follow the steps in DEVELOPMENT.md.
-
To understand the architecture: See "Architecture" section in README.md.
Base class that all config updaters inherit from. Provides:
load_config(path)- Load JSON configconfirm_backup(path, flag)- Prompt for backup confirmationwrite_config(path, config)- Atomically write config
Implemented for specific config fields:
UsernameConfigUpdater- Updates username field with signature recalculation
Functions that coordinate the update flow:
_handle_set_username(args)- Orchestrates username update
In build_parser():
- Create
argparsesubparser - Set default handler via
set_defaults(handler=...) - CLI routes to handler based on command
The CLI is built on these principles:
- Safety First: Backup confirmation, atomic writes, clear warnings
- Extensibility: Easy to add new commands via base classes
- Clarity: Well-documented code with comprehensive docstrings
- Consistency: All config updaters follow the same pattern
- Usability: Works both interactively and in automation scripts
See QUICKSTART.md - "Update username"
See DEVELOPMENT.md - "Step-by-Step: Adding a New Config Updater"
See DEVELOPMENT.md - "Adding a New Command Namespace"
source venv37/bin/activate
python3 -m pytest tests/ -vpython3 cli/cli.py --help
python3 cli/cli.py config --help
python3 cli/cli.py config set-username --help| Issue | Solution |
|---|---|
| ModuleNotFoundError | Activate venv: source venv37/bin/activate |
| Invalid JSON config | Check with: python3 -m json.tool config/config.json |
| "Aborted: backup confirmation" | Type 'yes' at prompt, or use --confirm-backup |
| Permission denied | Check file permissions: ls -l config/config.json |
See README.md for more troubleshooting.
Last Updated: February 2026
For issues or questions, see the README.md or DEVELOPMENT.md.