DIAMONDCLI — Build Command Lines Like a BOSS
DiamondCLI is a Python library that lets you create global Windows commands using simple Python scripts.
It behaves like a tiny custom operating system inside your user folder.
What DiamondCLI Does
When installed, DiamondCLI automatically creates:
C:\Users\<your username>\dcli
This folder becomes your command center.
Any .py script you drop inside it becomes a runnable command.
Example:
dcli run notif
Boom — your Python command runs globally from ANY directory.
Setting Up the Global dcli Command
To make dcli a real Windows command, you need two files inside your dcli folder:
1. dcli.bat
This ensures Windows can run the launcher even if .py files aren’t associated with Python.
Create:
C:\Users\<your username>\dcli\dcli.bat
Put this inside:
@echo off
python "%~dp0dcli.py" %*
2. dcli.py
This is the actual launcher that loads your command scripts.
Create:
C:\Users\<your username>\dcli\dcli.py
Put this inside:
import sys
import os
import importlib.util
import diamondcli
import getpass
USERNAME = getpass.getuser()
SCRIPTS_DIR = fr"C:\Users\{USERNAME}\dcli"
def load_scripts():
if not os.path.isdir(SCRIPTS_DIR):
print(f"[dcli] Script directory not found: {SCRIPTS_DIR}")
return
for filename in os.listdir(SCRIPTS_DIR):
if filename.endswith(".py"):
path = os.path.join(SCRIPTS_DIR, filename)
mod_name = filename[:-3]
spec = importlib.util.spec_from_file_location(mod_name, path)
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
def main():
load_scripts()
diamondcli.core.cli_main(sys.argv[1:])
if __name__ == "__main__":
main()
This launcher:
- detects the user’s real Windows username
- loads every
.pyscript in thedclifolder - registers commands
- runs them globally
Add the Folder to PATH
Open Environment Variables → Path → Edit → New
Add:
C:\Users\<your username>\dcli
Press OK on everything.
Restart CMD or PowerShell.
Test It
Run:
dcli
If you see:
[diamondcli] No arguments. Usage: dcli run <command>
You did everything right.
Now create a script:
C:\Users\<your username>\dcli\test.py
Put this inside:
import diamondcli as dcli
from diamondcli import *
@dcli.command("test")
def test():
log("Test command started")
shownotif("DiamondCLI Test", "Your test command is working!", duration=5)
log("Test command finished")
end()
Run it:
dcli run test
You now have a real global command powered by Python.
Summary
- DiamondCLI auto‑creates your command folder
- You add a launcher + batch wrapper
- You add the folder to PATH
- You drop Python scripts inside
- You run them globally with
dcli run <command>
You just built your own mini command‑line operating system.
Release files for diamondcli 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| diamondcli-1.0.1.tar.gz | 4.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| diamondcli-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.3 kB
Release files / diamondcli-1.0.1.tar.gz
| Download URL | diamondcli-1.0.1.tar.gz |
|---|---|
| Size | 4.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
63f1ba5c701d1b8c8aafdd69c96ca1c26ab23e3ec86cd32de5bf72180e4f18da
|
|
BLAKE2b-256 checksum How to use checksums |
7c34d795e1dbc3cdf184dea829c5a6009ee3a85b1149d51a7106a000500632da
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.14
|
Release files / diamondcli-1.0.1-py3-none-any.whl
| Download URL | diamondcli-1.0.1-py3-none-any.whl |
|---|---|
| Size | 5.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0f042933d80044923810c01e7968526d8aa27b53fdf99cee22786dc72ed4f4ae
|
|
BLAKE2b-256 checksum How to use checksums |
80e94b5e03670f7ed7ddc6547c25f0e595d8e7d8a1228f0242413676a9cd2927
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.14
|