A Windows command-line automation framework that lets you create global commands using Python.
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file diamondcli-1.0.0.tar.gz.
File metadata
- Download URL: diamondcli-1.0.0.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d5ee0e17d034f748e1a4294ef3def083e9565861ee978f39571b11f758dcda91
|
|
| MD5 |
a04031f8e5e5af8d7dab32506b962c92
|
|
| BLAKE2b-256 |
f319a78b42c5e69b0a136fc0f0a3b16e411bfb37392d92e89bbb20d8f64e6a70
|
File details
Details for the file diamondcli-1.0.0-py3-none-any.whl.
File metadata
- Download URL: diamondcli-1.0.0-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ccc07248a7be7db23ff9eb96e390bd2145e987ab66e97eeac5c52b24a7ccd9f8
|
|
| MD5 |
2703e67752044642ff9829a675e7508e
|
|
| BLAKE2b-256 |
71291e171a7c9a7f276ef4d2791596c0c63d49e9c8fbf2bacbd21196c509b906
|