ngenctl
Universal command wrapper package that dispatches to /usr/local/bin/ngen-* scripts, environment commands, and supports aliases for quick access.
Installation
Install from PyPI:
pip install ngenctl
Or install from source:
pip install .
Note: Installation to /usr/local/bin requires sudo/root permissions. The package will automatically install bundled scripts to /usr/local/bin/ngen-* during installation.
Usage
The ngenctl command provides a unified interface for executing:
- Scripts from
/usr/local/bin/ngen-{command} - Environment commands available in PATH (configured via
config.json) - Aliases for quick command shortcuts (configured via
alias.json)
Command Resolution Priority
- Aliases - Commands defined in
$HOME/.ngen/alias.json - Scripts - Scripts from
/usr/local/bin/ngen-{command}or bundled scripts - Environment Commands - Commands from
$HOME/.ngen/config.jsonavailable in PATH
Examples
Scripts
If you have a script at /usr/local/bin/ngen-rancher, you can use it as:
ngenctl rancher --help
ngenctl rancher version
Aliases
Create aliases in $HOME/.ngen/alias.json:
{
"login": "rancher login",
"clusters": "rancher clusters",
"ci": "devops-ci",
"gn": "kubectl get nodes"
}
Then use the aliases:
ngenctl login # Executes: ngenctl rancher login
ngenctl clusters # Executes: ngenctl rancher clusters
ngenctl ci saas-app develop # Executes: ngenctl devops-ci saas-app develop
ngenctl gn # Executes: ngenctl kubectl get nodes
Environment Commands
Configure environment commands in $HOME/.ngen/config.json:
{
"doq": "doq",
"kubectl": "kubectl"
}
Then use them directly:
ngenctl doq ns develop-saas # Executes: doq ns develop-saas
ngenctl kubectl get nodes # Executes: kubectl get nodes
How It Works
- When you run
ngenctl {command}, the CLI dispatcher checks in this order:- Aliases: Checks if the command is defined in
$HOME/.ngen/alias.jsonand resolves it - Scripts: Looks for a script at
/usr/local/bin/ngen-{command}or bundled scripts - Environment Commands: Checks
$HOME/.ngen/config.jsonand verifies the command is available in PATH
- Aliases: Checks if the command is defined in
- If found, it executes the command with any additional arguments passed
- Scripts can be any executable file (bash, sh, Python, or binary)
- Aliases support recursive resolution and circular reference detection
Configuration
Aliases ($HOME/.ngen/alias.json)
Create command aliases to shorten frequently used commands:
{
"login": "rancher login",
"clusters": "rancher clusters",
"ci": "devops-ci",
"gn": "kubectl get nodes"
}
Aliases can reference other commands (scripts, environment commands, or other aliases). Circular references are automatically detected.
Environment Commands ($HOME/.ngen/config.json)
Map ngenctl commands to executables available in your PATH:
{
"doq": "doq",
"kubectl": "kubectl",
"docker": "docker"
}
Commands in config.json will only work if the actual executable is available in your PATH.
Adding New Commands
Method 1: Scripts
- Place a script at
/usr/local/bin/ngen-{your-command} - Make sure it's executable:
chmod +x /usr/local/bin/ngen-{your-command} - Use it with:
ngenctl {your-command}
Method 2: Aliases
- Edit
$HOME/.ngen/alias.json - Add your alias:
"{short-name}": "{full-command}" - Use it with:
ngenctl {short-name}
Example:
{
"login": "rancher login"
}
Then use: ngenctl login
Method 3: Environment Commands
- Edit
$HOME/.ngen/config.json - Add your command:
"{ngen-command}": "{actual-command-in-path}" - Ensure the actual command is available in your PATH
- Use it with:
ngenctl {ngen-command}
Example:
{
"doq": "doq"
}
Then use: ngenctl doq (if doq is in PATH)
Development
Building the Package
python -m build
Publishing to PyPI
Menggunakan script otomatis:
./publish.sh --test # Publish ke Test PyPI
./publish.sh --publish # Publish ke PyPI production
Atau manual:
python -m build
python -m twine check dist/*
python -m twine upload dist/*
Untuk panduan lengkap, lihat PUBLISH.md.
Repository
License
MIT
Release files for ngenctl 0.1.15
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ngenctl-0.1.15.tar.gz | 5.0 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ngenctl-0.1.15-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.1 MB
Release files / ngenctl-0.1.15.tar.gz
| Download URL | ngenctl-0.1.15.tar.gz |
|---|---|
| Size | 5.0 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
76242771b16454c48aa88921ff996502615e9f444ef8cd62e9559104487ed423
|
|
BLAKE2b-256 checksum How to use checksums |
c49d8a865d037d5fd3d76b695c9f2d28192c30464fa53dba6cbff5c23566f50e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.12
|
Release files / ngenctl-0.1.15-py3-none-any.whl
| Download URL | ngenctl-0.1.15-py3-none-any.whl |
|---|---|
| Size | 5.0 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3a2338466895620dc6abfeaccd1373eaabd486f8cb2e9cfaf83e9b4185b7ccbd
|
|
BLAKE2b-256 checksum How to use checksums |
b42809d179db94806aca4a23253ccb3e67ccfacf6949fda72255d02de4111cbf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.12
|