Metadata-Version: 2.4
Name: diamondcli
Version: 1.0.0
Summary: A Windows command-line automation framework that lets you create global commands using Python.
Author: Graham
License: DiamondCLI Proprietary License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Operating System :: Microsoft :: Windows
Classifier: License :: OSI Approved :: MIT License
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Topic :: System :: Shells
Classifier: Topic :: Utilities
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: win10toast>=0.9
Dynamic: license-file

---

# **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:

```python
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 `.py` script in the `dcli` folder  
- 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:

```python
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**.

---
