diff --git a/cheatbox/data.py b/cheatbox/data.py index 1badbd6..9b5c3e2 100644 --- a/cheatbox/data.py +++ b/cheatbox/data.py @@ -2,6 +2,7 @@ from pick import pick from pathlib import Path import os +from difflib import SequenceMatcher class Data: def __init__(self): @@ -9,15 +10,71 @@ def __init__(self): self.data_dir = self.base_dir / "data" self.domain: str = self.select_domain() + def fuzzy_search(self, query: str, options: list, threshold: float = 0.3) -> list: + """ + Fuzzy search implementation for matching cheats + Returns list of (score, option) tuples sorted by relevance + """ + results = [] + query_lower = query.lower() + + for option in options: + option_lower = option.lower() + + # Check for exact substring match (highest priority) + if query_lower in option_lower: + score = 1.0 + else: + # Use SequenceMatcher for fuzzy matching + score = SequenceMatcher(None, query_lower, option_lower).ratio() + + if score >= threshold: + results.append((score, option)) + + # Sort by score descending + results.sort(reverse=True, key=lambda x: x[0]) + return [option for score, option in results] + def select_domain(self) -> str: - """Select domain to display""" - domains = [ + """Select domain to display with search option""" + domains = sorted([ file.stem for file in self.data_dir.glob("*.json") if file.name != "ascii.json" - ] - title = "CheatBox> Select the cheatsheet to display" - domain = pick(options=domains, title=title) - return str(domain[0]) # only return the name + ]) + + # Add search option at the top + options_with_search = ["🔍 Search Cheatsheets..."] + domains + + title = "CheatBox> Select the cheatsheet" + selected, index = pick( + options=options_with_search, + title=title, + indicator="→" + ) + + # If search option selected, prompt for query + if index == 0: + import typer + query = typer.prompt("Enter search query") + results = self.fuzzy_search(query, domains, threshold=0.3) + + if not results: + typer.echo(f"❌ No cheatsheets found matching '{query}'") + # Recurse to show menu again + return self.select_domain() + + if len(results) == 1: + return results[0] + + # Multiple results, let user pick + selected_result, _ = pick( + options=results, + title=f"🔍 Search results for '{query}'", + indicator="→" + ) + return selected_result + + return str(selected) # Return the selected domain def read_domain(self): """Read the content of the domain""" @@ -26,7 +83,7 @@ def read_domain(self): return json.load(f) except Exception as e: print(f"Error loading {self.domain}.json: {e}") - return {} # Return empty dict instead of None to prevent crashes + return {} # Return empty dict instead of None to prevent crashes def run(self): """Runner for data fetch""" diff --git a/cheatbox/main.py b/cheatbox/main.py index 56fbb07..3fbc708 100644 --- a/cheatbox/main.py +++ b/cheatbox/main.py @@ -9,8 +9,43 @@ @app.command() def list(): - domain = Data().run() - Display().display_bento(domain) + """Browse and display cheatsheets""" + data = Data() + domain_data = data.run() + Display().display_bento(domain_data) + +@app.command() +def search(query: str = typer.Argument(..., help="Search query for fuzzy search")): + """Search through available cheatsheets using fuzzy matching""" + from pathlib import Path + base_dir = Path(__file__).parent.parent + data_dir = base_dir / "data" + + domains = sorted([ + file.stem for file in data_dir.glob("*.json") + if file.name != "ascii.json" + ]) + + data = Data() + results = data.fuzzy_search(query, domains, threshold=0.2) + + if not results: + typer.echo(f"❌ No cheatsheets found matching '{query}'") + return + + if len(results) == 1: + data.domain = results[0] + domain_data = data.read_domain() + Display().display_bento(domain_data) + else: + selected_cheat, _ = pick( + options=results, + title=f"🔍 Search results for '{query}'", + indicator="→" + ) + data.domain = selected_cheat + domain_data = data.read_domain() + Display().display_bento(domain_data) @app.callback(invoke_without_command=True) def main(ctx: typer.Context): diff --git a/data/asdf.json b/data/asdf.json new file mode 100644 index 0000000..2960d36 --- /dev/null +++ b/data/asdf.json @@ -0,0 +1,124 @@ +{ + "LOGO": [ + { + "ascii": [ + "[blue] █████╗ ███████╗██████╗ ███████╗[/blue]", + "[blue] ██╔══██╗██╔════╝██╔══██╗██╔════╝[/blue]", + "[blue] ███████║███████╗██║ ██║█████╗ [/blue]", + "[blue] ██╔══██║╚════██║██║ ██║██╔══╝ [/blue]", + "[blue] ██║ ██║███████║██████╔╝██║ [/blue]", + "[blue] ╚═╝ ╚═╝╚══════╝╚═════╝ ╚═╝ [/blue]" + ] + } + ], + "TITLE": [ + { + "ascii": [ + " _ __ ", + " __ _ ___ __| |/ _|", + " / _` / __|/ _` | |_ ", + " | (_| \\__ \\ (_| | _|", + " \\__,_|___/\\__,_|_| " + ] + } + ], + "STYLE": { + "command_width": 40, + "outer_width": 140, + "primary_color": "blue" + }, + "Installation": [ + { + "command": "git clone https://github.com/asdf-vm/asdf.git ~/.asdf", + "description": "Clone asdf to home directory" + }, + { + "command": "asdf --version", + "description": "Show asdf version" + } + ], + "Plugins": [ + { + "command": "asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git", + "description": "Add a plugin" + }, + { + "command": "asdf plugin list", + "description": "List installed plugins" + }, + { + "command": "asdf plugin list all", + "description": "List available plugins" + }, + { + "command": "asdf plugin remove nodejs", + "description": "Remove a plugin" + } + ], + "Version Management": [ + { + "command": "asdf list", + "description": "List installed versions" + }, + { + "command": "asdf list nodejs", + "description": "List installed versions of plugin" + }, + { + "command": "asdf list all nodejs", + "description": "List available versions" + } + ], + "Installation & Switching": [ + { + "command": "asdf install nodejs 18.16.0", + "description": "Install specific version" + }, + { + "command": "asdf install nodejs latest", + "description": "Install latest version" + }, + { + "command": "asdf global nodejs 18.16.0", + "description": "Set global version" + }, + { + "command": "asdf local nodejs 18.16.0", + "description": "Set local version (.tool-versions)" + } + ], + "Versions": [ + { + "command": "asdf current", + "description": "Show current versions" + }, + { + "command": "asdf current nodejs", + "description": "Show current version of tool" + } + ], + "Updates": [ + { + "command": "asdf update", + "description": "Update asdf itself" + }, + { + "command": "asdf plugin update nodejs", + "description": "Update plugin" + }, + { + "command": "asdf plugin update --all", + "description": "Update all plugins" + } + ], + "Cleanup": [ + { + "command": "asdf uninstall nodejs 18.16.0", + "description": "Remove specific version" + }, + { + "command": "asdf reshim", + "description": "Rebuild shims" + } + ] +} diff --git a/data/cargo.json b/data/cargo.json new file mode 100644 index 0000000..e9fff1a --- /dev/null +++ b/data/cargo.json @@ -0,0 +1,139 @@ +{ + "LOGO": [ + { + "ascii": [ + "[red] ██████╗ █████╗ ██████╗ ██████╗ ██████╗ [/red]", + "[red] ██╔════╝██╔══██╗██╔══██╗██╔════╝ ██╔═══██╗[/red]", + "[red] ██║ ███████║██████╔╝██║ ███╗██║ ██║[/red]", + "[red] ██║ ██╔══██║██╔══██╗██║ ██║██║ ██║[/red]", + "[red] ╚██████╗██║ ██║██║ ██║╚██████╔╝╚██████╔╝[/red]", + "[red] ╚═════╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚═════╝ [/red]" + ] + } + ], + "TITLE": [ + { + "ascii": [ + " ____ ", + " / ___|__ _ _ __ __ _ ___ ", + " | | / _` | '__/ _` |/ _ \\ ", + " | |__| (_| | | | (_| | (_) | ", + " \\____\\__,_|_| \\__, |\\___/ ", + " |___/ " + ] + } + ], + "STYLE": { + "command_width": 35, + "outer_width": 140, + "primary_color": "red" + }, + "Project Setup": [ + { + "command": "cargo new project_name", + "description": "Create a new Rust project" + }, + { + "command": "cargo new --lib project_name", + "description": "Create a new Rust library" + }, + { + "command": "cargo init", + "description": "Initialize Cargo in current directory" + } + ], + "Building": [ + { + "command": "cargo build", + "description": "Build debug binary" + }, + { + "command": "cargo build --release", + "description": "Build optimized release binary" + }, + { + "command": "cargo build --target wasm32-unknown-unknown", + "description": "Build for specific target" + } + ], + "Running": [ + { + "command": "cargo run", + "description": "Build and run the project" + }, + { + "command": "cargo run --release", + "description": "Build and run optimized" + }, + { + "command": "cargo run -- --arg1 --arg2", + "description": "Pass arguments to binary" + } + ], + "Dependency Management": [ + { + "command": "cargo add package_name", + "description": "Add a dependency" + }, + { + "command": "cargo add --dev package_name", + "description": "Add dev dependency" + }, + { + "command": "cargo remove package_name", + "description": "Remove a dependency" + }, + { + "command": "cargo update", + "description": "Update dependencies" + } + ], + "Code Quality": [ + { + "command": "cargo check", + "description": "Check code for errors (fast)" + }, + { + "command": "cargo fmt", + "description": "Format code" + }, + { + "command": "cargo clippy", + "description": "Lint code (requires clippy)" + } + ], + "Testing": [ + { + "command": "cargo test", + "description": "Run all tests" + }, + { + "command": "cargo test test_name", + "description": "Run specific test" + }, + { + "command": "cargo test -- --test-threads=1", + "description": "Run tests sequentially" + } + ], + "Documentation": [ + { + "command": "cargo doc --open", + "description": "Generate and open documentation" + }, + { + "command": "cargo doc --no-deps", + "description": "Generate docs (exclude dependencies)" + } + ], + "Publishing": [ + { + "command": "cargo publish", + "description": "Publish to crates.io" + }, + { + "command": "cargo publish --dry-run", + "description": "Simulate publishing" + } + ] +} diff --git a/data/conda.json b/data/conda.json new file mode 100644 index 0000000..e75d91f --- /dev/null +++ b/data/conda.json @@ -0,0 +1,102 @@ +{ + "LOGO": [ + { + "ascii": [ + "[green] ██████╗ ██████╗ ███╗ ██╗██████╗ █████╗ [/green]", + "[green] ██╔════╝██╔═══██╗████╗ ██║██╔══██╗██╔══██╗[/green]", + "[green] ██║ ██║ ██║██╔██╗ ██║██║ ██║███████║[/green]", + "[green] ██║ ██║ ██║██║╚██╗██║██║ ██║██╔══██║[/green]", + "[green] ╚██████╗╚██████╔╝██║ ╚████║██████╔╝██║ ██║[/green]", + "[green] ╚═════╝ ╚═════╝ ╚═╝ ╚═══╝╚═════╝ ╚═╝ ╚═╝[/green]" + ] + } + ], + "TITLE": [ + { + "ascii": [ + " ____ _ ", + " / ___|___ _ __ __| | __ _ ", + " | | / _ \\| '_ \\ / _` |/ _` |", + " | |__| (_) | | | | (_| | (_| |", + " \\____\\___/|_| |_|\\__,_|\\__,_|" + ] + } + ], + "STYLE": { + "command_width": 30, + "outer_width": 140, + "primary_color": "cyan" + }, + "Environment Management": [ + { + "command": "conda create -n myenv python=3.10", + "description": "Create a new conda environment with Python 3.10" + }, + { + "command": "conda activate myenv", + "description": "Activate the conda environment" + }, + { + "command": "conda deactivate", + "description": "Deactivate the current conda environment" + }, + { + "command": "conda env list", + "description": "List all conda environments" + }, + { + "command": "conda remove -n myenv --all", + "description": "Remove a conda environment" + } + ], + "Package Management": [ + { + "command": "conda install numpy pandas", + "description": "Install packages into the current environment" + }, + { + "command": "conda install -c conda-forge package_name", + "description": "Install from conda-forge channel" + }, + { + "command": "conda list", + "description": "List installed packages in the current environment" + }, + { + "command": "conda update package_name", + "description": "Update a package to the latest version" + }, + { + "command": "conda remove package_name", + "description": "Uninstall a package" + } + ], + "Searching & Info": [ + { + "command": "conda search package_name", + "description": "Search for available packages" + }, + { + "command": "conda info", + "description": "Display conda version and system information" + }, + { + "command": "conda info --envs", + "description": "Show detailed information about all environments" + } + ], + "Environment Files": [ + { + "command": "conda env export > environment.yml", + "description": "Export current environment to YAML file" + }, + { + "command": "conda env create -f environment.yml", + "description": "Create environment from YAML file" + }, + { + "command": "conda env update -f environment.yml", + "description": "Update environment from YAML file" + } + ] +} diff --git a/data/curl.json b/data/curl.json new file mode 100644 index 0000000..45baf3a --- /dev/null +++ b/data/curl.json @@ -0,0 +1,124 @@ +{ + "LOGO": [ + { + "ascii": [ + "[yellow] ██████╗██╗ ██╗██████╗ ██╗ [/yellow]", + "[yellow] ██╔════╝██║ ██║██╔══██╗██║ [/yellow]", + "[yellow] ██║ ██║ ██║██████╔╝██║ [/yellow]", + "[yellow] ██║ ██║ ██║██╔══██╗██║ [/yellow]", + "[yellow] ╚██████╗╚██████╔╝██║ ██║███████╗[/yellow]", + "[yellow] ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝[/yellow]" + ] + } + ], + "TITLE": [ + { + "ascii": [ + " ____ _ ", + " / ___| _ _ __| |", + " | | | | | | '__| |", + " | |__| |_| | | | |", + " \\____\\__,_|_| |_|" + ] + } + ], + "STYLE": { + "command_width": 40, + "outer_width": 140, + "primary_color": "yellow" + }, + "Basic Commands": [ + { + "command": "curl https://example.com", + "description": "Fetch a URL" + }, + { + "command": "curl -i https://example.com", + "description": "Include response headers" + }, + { + "command": "curl -I https://example.com", + "description": "Show headers only" + } + ], + "Request Methods": [ + { + "command": "curl -X POST https://api.example.com/data", + "description": "Make a POST request" + }, + { + "command": "curl -X PUT -d 'data' https://api.example.com", + "description": "Make a PUT request" + }, + { + "command": "curl -X DELETE https://api.example.com/id", + "description": "Make a DELETE request" + } + ], + "Data & Headers": [ + { + "command": "curl -d 'param1=value1¶m2=value2' https://api.example.com", + "description": "Send form data" + }, + { + "command": "curl -d '{\"key\":\"value\"}' -H 'Content-Type: application/json' https://api.example.com", + "description": "Send JSON data" + }, + { + "command": "curl -H 'Authorization: Bearer TOKEN' https://api.example.com", + "description": "Add custom header" + } + ], + "File Operations": [ + { + "command": "curl https://example.com/file.zip -o file.zip", + "description": "Download file with custom name" + }, + { + "command": "curl https://example.com/file.zip -O", + "description": "Download with original filename" + }, + { + "command": "curl -F 'file=@file.txt' https://api.example.com/upload", + "description": "Upload a file" + } + ], + "Authentication": [ + { + "command": "curl -u username:password https://api.example.com", + "description": "Basic authentication" + }, + { + "command": "curl --oauth2-bearer TOKEN https://api.example.com", + "description": "OAuth2 bearer token" + } + ], + "Verbose & Debugging": [ + { + "command": "curl -v https://example.com", + "description": "Verbose output" + }, + { + "command": "curl --trace - https://example.com", + "description": "Full trace of request/response" + }, + { + "command": "curl -w '%{http_code}' https://example.com", + "description": "Show HTTP status code" + } + ], + "Advanced": [ + { + "command": "curl -b 'cookie=value' https://example.com", + "description": "Send cookies" + }, + { + "command": "curl -L https://example.com", + "description": "Follow redirects" + }, + { + "command": "curl --max-time 10 https://example.com", + "description": "Set timeout (10 seconds)" + } + ] +} diff --git a/data/distrobox.json b/data/distrobox.json new file mode 100644 index 0000000..8d974a1 --- /dev/null +++ b/data/distrobox.json @@ -0,0 +1,96 @@ +{ + "LOGO": [ + { + "ascii": [ + "[blue] ██████╗ ██╗███████╗████████╗██████╗ ██████╗ [/blue]", + "[blue] ██╔══██╗██║██╔════╝╚══██╔══╝██╔══██╗██╔═══██╗[/blue]", + "[blue] ██║ ██║██║███████╗ ██║ ██████╔╝██║ ██║[/blue]", + "[blue] ██║ ██║██║╚════██║ ██║ ██╔══██╗██║ ██║[/blue]", + "[blue] ██████╔╝██║███████║ ██║ ██║ ██║╚██████╔╝[/blue]", + "[blue] ╚═════╝ ╚═╝╚══════╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ [/blue]" + ] + } + ], + "TITLE": [ + { + "ascii": [ + " ____ _ _ _ ", + " | _ \\(_)___| |_ _ __ ___ | |__ _____ __", + " | | | | / __| __| '__/ _ \\| '_ \\ / _ \\ \\/ /", + " | |_| | \\__ \\ |_| | | (_) | |_) | (_) > < ", + " |____/|_|___/\\__|_| \\___/|_.__/ \\___/_/\\_\\" + ] + } + ], + "STYLE": { + "command_width": 40, + "outer_width": 140, + "primary_color": "blue" + }, + "Container Management": [ + { + "command": "distrobox create --name mybox --image ubuntu:22.04", + "description": "Create a new distrobox container" + }, + { + "command": "distrobox create -n mybox -i fedora:latest", + "description": "Create with custom image (short options)" + }, + { + "command": "distrobox enter mybox", + "description": "Enter/access a distrobox container" + }, + { + "command": "distrobox list", + "description": "List all distrobox containers" + }, + { + "command": "distrobox remove mybox", + "description": "Remove a distrobox container" + } + ], + "Running Commands": [ + { + "command": "distrobox-run -n mybox -- command", + "description": "Run a command inside a distrobox" + }, + { + "command": "distrobox run -n mybox -- apt update", + "description": "Run apt update in the container" + } + ], + "Container Customization": [ + { + "command": "distrobox create --name mybox --image debian:bookworm --home /custom/home", + "description": "Create with custom home directory" + }, + { + "command": "distrobox create -n mybox -i alpine:latest --init", + "description": "Create with init system enabled" + } + ], + "Host Integration": [ + { + "command": "distrobox-export --app myapp --export-path ~/.local/bin", + "description": "Export an application from container to host" + }, + { + "command": "distrobox-enter mybox -- sudo apt install package", + "description": "Install packages in the container" + } + ], + "Info & Upgrade": [ + { + "command": "distrobox ps", + "description": "Show running distrobox containers" + }, + { + "command": "distrobox upgrade", + "description": "Upgrade all distrobox containers" + }, + { + "command": "distrobox version", + "description": "Show distrobox version" + } + ] +} diff --git a/data/du.json b/data/du.json new file mode 100644 index 0000000..5e85ef8 --- /dev/null +++ b/data/du.json @@ -0,0 +1,88 @@ +{ + "LOGO": [ + { + "ascii": [ + "[magenta] ██████╗ ██╗ ██╗[/magenta]", + "[magenta] ██╔══██╗██║ ██║[/magenta]", + "[magenta] ██║ ██║██║ ██║[/magenta]", + "[magenta] ██║ ██║██║ ██║[/magenta]", + "[magenta] ██████╔╝╚██████╔╝[/magenta]", + "[magenta] ╚═════╝ ╚═════╝ [/magenta]" + ] + } + ], + "TITLE": [ + { + "ascii": [ + " _ ", + " __| |_ _ ", + " / _` | | | |", + " | (_| | |_| |", + " \\__,_|\\__,_|" + ] + } + ], + "STYLE": { + "command_width": 35, + "outer_width": 140, + "primary_color": "magenta" + }, + "Basic Commands": [ + { + "command": "du -sh directory/", + "description": "Show directory size (human-readable)" + }, + { + "command": "du -ah directory/", + "description": "Show size of all files" + }, + { + "command": "du -sh .*", + "description": "Show sizes of hidden directories" + } + ], + "Disk Usage": [ + { + "command": "df -h", + "description": "Show disk space usage" + }, + { + "command": "df -i", + "description": "Show inode usage" + }, + { + "command": "df -T", + "description": "Show filesystem type" + } + ], + "Finding Large Files": [ + { + "command": "du -sh /* | sort -rh", + "description": "Find largest directories" + }, + { + "command": "find . -type f -size +100M -exec ls -lh {} \\;", + "description": "Find files larger than 100MB" + } + ], + "Sorting & Reporting": [ + { + "command": "du -sh */ | sort -h", + "description": "Sort directories by size" + }, + { + "command": "du --max-depth=2 -h", + "description": "Show size up to 2 levels deep" + } + ], + "Excluding Paths": [ + { + "command": "du -sh --exclude='*.log' directory/", + "description": "Exclude file pattern" + }, + { + "command": "du -sh --exclude='.git' directory/", + "description": "Exclude directory" + } + ] +} diff --git a/data/fastfetch.json b/data/fastfetch.json new file mode 100644 index 0000000..e86fee4 --- /dev/null +++ b/data/fastfetch.json @@ -0,0 +1,114 @@ +{ + "LOGO": [ + { + "ascii": [ + "[cyan] ███████╗ █████╗ ███████╗████████╗[/cyan]", + "[cyan] ██╔════╝██╔══██╗██╔════╝╚══██╔══╝[/cyan]", + "[cyan] █████╗ ███████║███████╗ ██║ [/cyan]", + "[cyan] ██╔══╝ ██╔══██║╚════██║ ██║ [/cyan]", + "[cyan] ██║ ██║ ██║███████║ ██║ [/cyan]", + "[cyan] ╚═╝ ╚═╝ ╚═╝╚══════╝ ╚═╝ [/cyan]" + ] + } + ], + "TITLE": [ + { + "ascii": [ + " _____ _ __ _ _ ", + " | ___|_ _ ___| |_ / _| ___| |_ ___| |__ ", + " | |_ / _` / __| __| |_ / _ \\ __/ __| '_ \\ ", + " | _| (_| \\__ \\ |_| _| __/ || (__| | | |", + " |_| \\__,_|___/\\__|_| \\___|\\__\\___|_| |_|" + ] + } + ], + "STYLE": { + "command_width": 25, + "outer_width": 140, + "primary_color": "green" + }, + "Basic Info": [ + { + "command": "fastfetch", + "description": "Display full system information with logo" + }, + { + "command": "fastfetch --help", + "description": "Show all available options" + }, + { + "command": "fastfetch --version", + "description": "Show fastfetch version" + } + ], + "Configuration": [ + { + "command": "fastfetch --config /path/to/config.json", + "description": "Use a custom configuration file" + }, + { + "command": "fastfetch --config none", + "description": "Ignore all configuration files" + }, + { + "command": "mkdir -p ~/.config/fastfetch", + "description": "Create config directory" + } + ], + "Output Customization": [ + { + "command": "fastfetch --logo none", + "description": "Hide the logo" + }, + { + "command": "fastfetch --logo small", + "description": "Show smaller logo" + }, + { + "command": "fastfetch --logo-width 30", + "description": "Set logo width in characters" + }, + { + "command": "fastfetch --color-keys blue", + "description": "Change label color" + } + ], + "Module Selection": [ + { + "command": "fastfetch --modules os host cpu memory", + "description": "Show specific modules only" + }, + { + "command": "fastfetch --modules all", + "description": "Show all available modules" + }, + { + "command": "fastfetch --show cpu memory gpu disk", + "description": "Display selected modules" + } + ], + "Output Formats": [ + { + "command": "fastfetch -o json", + "description": "Output as JSON" + }, + { + "command": "fastfetch -o csv", + "description": "Output as CSV" + }, + { + "command": "fastfetch --no-color", + "description": "Disable colored output" + } + ], + "Screen Modes": [ + { + "command": "fastfetch --screen-height 30", + "description": "Set terminal height for display" + }, + { + "command": "fastfetch --screen-width 80", + "description": "Set terminal width for display" + } + ] +} diff --git a/data/find.json b/data/find.json new file mode 100644 index 0000000..47ef702 --- /dev/null +++ b/data/find.json @@ -0,0 +1,120 @@ +{ + "LOGO": [ + { + "ascii": [ + "[cyan] ███████╗██╗███╗ ██╗██████╗ [/cyan]", + "[cyan] ██╔════╝██║████╗ ██║██╔══██╗[/cyan]", + "[cyan] █████╗ ██║██╔██╗ ██║██║ ██║[/cyan]", + "[cyan] ██╔══╝ ██║██║╚██╗██║██║ ██║[/cyan]", + "[cyan] ██║ ██║██║ ╚████║██████╔╝[/cyan]", + "[cyan] ╚═╝ ╚═╝╚═╝ ╚═══╝╚═════╝ [/cyan]" + ] + } + ], + "TITLE": [ + { + "ascii": [ + " _____ _ _ ", + " | ___(_)_ __ __| |", + " | |_ | | '_ \\ / _` |", + " | _| | | | | | (_| |", + " |_| |_|_| |_|\\__,_|" + ] + } + ], + "STYLE": { + "command_width": 35, + "outer_width": 140, + "primary_color": "cyan" + }, + "File Creation": [ + { + "command": "find . -name 'pattern'", + "description": "Find files by name" + }, + { + "command": "find . -name '*.txt'", + "description": "Find by file extension" + }, + { + "command": "find . -iname 'pattern'", + "description": "Case-insensitive find" + } + ], + "File Type": [ + { + "command": "find . -type f", + "description": "Find only files" + }, + { + "command": "find . -type d", + "description": "Find only directories" + }, + { + "command": "find . -type l", + "description": "Find symbolic links" + } + ], + "File Size": [ + { + "command": "find . -size +100M", + "description": "Find files larger than 100MB" + }, + { + "command": "find . -size -10k", + "description": "Find files smaller than 10KB" + }, + { + "command": "find . -size 50M", + "description": "Find files exactly 50MB" + } + ], + "File Age": [ + { + "command": "find . -mtime -7", + "description": "Modified in last 7 days" + }, + { + "command": "find . -atime +30", + "description": "Accessed more than 30 days ago" + }, + { + "command": "find . -newer file.txt", + "description": "Find files newer than file.txt" + } + ], + "Permissions": [ + { + "command": "find . -perm -644", + "description": "Find files with specific permissions" + }, + { + "command": "find . -user username", + "description": "Find files owned by user" + } + ], + "Actions": [ + { + "command": "find . -name '*.log' -delete", + "description": "Delete matching files" + }, + { + "command": "find . -name '*.txt' -exec cat {} \\;", + "description": "Execute command on matches" + }, + { + "command": "find . -name '*.jpg' -print0 | xargs -0 ls -lh", + "description": "Pipe results to another command" + } + ], + "Advanced": [ + { + "command": "find . -path '*/dir/*' -name '*.txt'", + "description": "Search in specific path" + }, + { + "command": "find . -not -name '*.log'", + "description": "Exclude pattern (NOT)" + } + ] +} diff --git a/data/git.json b/data/git.json new file mode 100644 index 0000000..43549f6 --- /dev/null +++ b/data/git.json @@ -0,0 +1,189 @@ +{ + "LOGO": [ + { + "ascii": [ + "[red] ██████╗ ██╗████████╗[/red]", + "[red] ██╔════╝ ██║╚══██╔══╝[/red]", + "[red] ██║ ███╗██║ ██║ [/red]", + "[red] ██║ ██║██║ ██║ [/red]", + "[red] ╚██████╔╝██║ ██║ [/red]", + "[red] ╚═════╝ ╚═╝ ╚═╝ [/red]" + ] + } + ], + "TITLE": [ + { + "ascii": [ + " _____ _ _ ", + " / ____(_) | ", + " | | __ _| |_ ", + " | | |_ | | __|", + " | |__| | | |_ ", + " \\_____|_|\\__|" + ] + } + ], + "STYLE": { + "command_width": 35, + "outer_width": 140, + "primary_color": "yellow" + }, + "Setup & Configuration": [ + { + "command": "git config --global user.name 'Your Name'", + "description": "Set your global git username" + }, + { + "command": "git config --global user.email 'your@email.com'", + "description": "Set your global git email" + }, + { + "command": "git config --global core.editor vim", + "description": "Set default text editor" + }, + { + "command": "git config --list", + "description": "Show all git configurations" + } + ], + "Repository Basics": [ + { + "command": "git init", + "description": "Initialize a new git repository" + }, + { + "command": "git clone ", + "description": "Clone a remote repository" + }, + { + "command": "git status", + "description": "Show working tree status" + } + ], + "Staging & Committing": [ + { + "command": "git add ", + "description": "Stage a specific file" + }, + { + "command": "git add .", + "description": "Stage all changes" + }, + { + "command": "git commit -m 'message'", + "description": "Commit staged changes" + }, + { + "command": "git commit -am 'message'", + "description": "Stage and commit tracked files" + } + ], + "Branching": [ + { + "command": "git branch", + "description": "List local branches" + }, + { + "command": "git branch -a", + "description": "List all branches (local and remote)" + }, + { + "command": "git branch ", + "description": "Create a new branch" + }, + { + "command": "git switch ", + "description": "Switch to a branch" + }, + { + "command": "git checkout -b ", + "description": "Create and switch to new branch" + } + ], + "Remote Repository": [ + { + "command": "git remote -v", + "description": "Show remote repositories" + }, + { + "command": "git remote add origin ", + "description": "Add a remote repository" + }, + { + "command": "git push origin main", + "description": "Push commits to remote" + }, + { + "command": "git pull origin main", + "description": "Fetch and merge remote changes" + } + ], + "Merging & Rebasing": [ + { + "command": "git merge ", + "description": "Merge another branch into current branch" + }, + { + "command": "git rebase ", + "description": "Rebase current branch" + }, + { + "command": "git merge --abort", + "description": "Cancel a merge in progress" + } + ], + "History & Inspection": [ + { + "command": "git log", + "description": "Show commit history" + }, + { + "command": "git log --oneline", + "description": "Show concise commit history" + }, + { + "command": "git log --graph --all --oneline", + "description": "Show visual branch history" + }, + { + "command": "git diff", + "description": "Show unstaged changes" + }, + { + "command": "git diff --staged", + "description": "Show staged changes" + } + ], + "Undoing Changes": [ + { + "command": "git restore ", + "description": "Discard changes to a file" + }, + { + "command": "git restore --staged ", + "description": "Unstage a file" + }, + { + "command": "git reset HEAD~1", + "description": "Undo last commit (keep changes)" + }, + { + "command": "git revert ", + "description": "Create new commit that undoes changes" + } + ], + "Tagging": [ + { + "command": "git tag v1.0.0", + "description": "Create a lightweight tag" + }, + { + "command": "git tag -a v1.0.0 -m 'Release 1.0.0'", + "description": "Create an annotated tag" + }, + { + "command": "git push origin v1.0.0", + "description": "Push a specific tag" + } + ] +} diff --git a/data/go.json b/data/go.json new file mode 100644 index 0000000..d062595 --- /dev/null +++ b/data/go.json @@ -0,0 +1,128 @@ +{ + "LOGO": [ + { + "ascii": [ + "[cyan] ██████╗ ██████╗ [/cyan]", + "[cyan] ██╔════╝ ██╔═══██╗[/cyan]", + "[cyan] ██║ ███╗██║ ██║[/cyan]", + "[cyan] ██║ ██║██║ ██║[/cyan]", + "[cyan] ╚██████╔╝╚██████╔╝[/cyan]", + "[cyan] ╚═════╝ ╚═════╝ [/cyan]" + ] + } + ], + "TITLE": [ + { + "ascii": [ + " ____ ", + " / ___| ___ ", + " | | _ / _ \\ ", + " | |_| | (_) |", + " \\____|\\___/ " + ] + } + ], + "STYLE": { + "command_width": 35, + "outer_width": 140, + "primary_color": "blue" + }, + "Compilation": [ + { + "command": "go build", + "description": "Build the current package" + }, + { + "command": "go build -o binary_name", + "description": "Build with custom output name" + }, + { + "command": "go build ./cmd/app", + "description": "Build from subdirectory" + } + ], + "Running Code": [ + { + "command": "go run main.go", + "description": "Compile and run a Go file" + }, + { + "command": "go run ./cmd/app", + "description": "Run from subdirectory" + } + ], + "Module Management": [ + { + "command": "go mod init github.com/user/project", + "description": "Initialize a new Go module" + }, + { + "command": "go mod tidy", + "description": "Clean up unused dependencies" + }, + { + "command": "go mod download", + "description": "Download module dependencies" + }, + { + "command": "go list -m all", + "description": "List all dependencies" + } + ], + "Dependency Management": [ + { + "command": "go get github.com/user/package", + "description": "Fetch and add a package" + }, + { + "command": "go get -u github.com/user/package", + "description": "Update a package to latest version" + }, + { + "command": "go get github.com/user/package@v1.2.3", + "description": "Get specific version" + } + ], + "Testing": [ + { + "command": "go test", + "description": "Run tests in current package" + }, + { + "command": "go test ./...", + "description": "Run tests in all packages" + }, + { + "command": "go test -v", + "description": "Verbose test output" + }, + { + "command": "go test -cover", + "description": "Show test coverage" + } + ], + "Code Quality": [ + { + "command": "go fmt ./...", + "description": "Format all Go files" + }, + { + "command": "go vet ./...", + "description": "Analyze code for errors" + }, + { + "command": "golint ./...", + "description": "Lint code (requires golint)" + } + ], + "Installation": [ + { + "command": "go install github.com/user/app@latest", + "description": "Install a Go binary" + }, + { + "command": "go install ./cmd/app", + "description": "Install from local source" + } + ] +} diff --git a/data/grep.json b/data/grep.json new file mode 100644 index 0000000..fe6c22f --- /dev/null +++ b/data/grep.json @@ -0,0 +1,101 @@ +{ + "LOGO": [ + { + "ascii": [ + "[green] ██████╗ ██████╗ ███████╗██████╗ [/green]", + "[green] ██╔════╝ ██╔══██╗██╔════╝██╔══██╗[/green]", + "[green] ██║ ███╗██████╔╝█████╗ ██████╔╝[/green]", + "[green] ██║ ██║██╔══██╗██╔══╝ ██╔═══╝ [/green]", + "[green] ╚██████╔╝██║ ██║███████╗██║ [/green]", + "[green] ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ [/green]" + ] + } + ], + "TITLE": [ + { + "ascii": [ + " ____ ", + " / ___|_ __ ___ _ __ ", + " | | _| '__/ _ \\ '_ \\ ", + " | |_| | | | __/ |_) | ", + " \\____|_| \\___| .__/ ", + " |_| " + ] + } + ], + "STYLE": { + "command_width": 35, + "outer_width": 140, + "primary_color": "blue" + }, + "Text Search": [ + { + "command": "grep 'pattern' file.txt", + "description": "Search for pattern in file" + }, + { + "command": "grep -i 'pattern' file.txt", + "description": "Case-insensitive search" + }, + { + "command": "grep -n 'pattern' file.txt", + "description": "Show line numbers" + } + ], + "Extended Patterns": [ + { + "command": "grep -E 'regex|pattern' file.txt", + "description": "Use extended regex" + }, + { + "command": "grep -P 'perl_regex' file.txt", + "description": "Use Perl regex patterns" + } + ], + "Search Scope": [ + { + "command": "grep -r 'pattern' /path/to/dir", + "description": "Recursive search in directory" + }, + { + "command": "grep -l 'pattern' *.txt", + "description": "Show only filenames" + }, + { + "command": "grep -c 'pattern' file.txt", + "description": "Count matching lines" + } + ], + "Filtering": [ + { + "command": "grep -v 'pattern' file.txt", + "description": "Invert match (show non-matching)" + }, + { + "command": "grep -A 3 'pattern' file.txt", + "description": "Show 3 lines after match" + }, + { + "command": "grep -B 3 'pattern' file.txt", + "description": "Show 3 lines before match" + }, + { + "command": "grep -C 2 'pattern' file.txt", + "description": "Show 2 lines context (before & after)" + } + ], + "Advanced": [ + { + "command": "grep -w 'word' file.txt", + "description": "Match whole words only" + }, + { + "command": "grep '^pattern' file.txt", + "description": "Match at start of line" + }, + { + "command": "grep 'pattern$' file.txt", + "description": "Match at end of line" + } + ] +} diff --git a/data/make.json b/data/make.json new file mode 100644 index 0000000..a373fd1 --- /dev/null +++ b/data/make.json @@ -0,0 +1,114 @@ +{ + "LOGO": [ + { + "ascii": [ + "[red] ███╗ ███╗ █████╗ ██╗ ██╗███████╗[/red]", + "[red] ████╗ ████║██╔══██╗██║ ██╔╝██╔════╝[/red]", + "[red] ██╔████╔██║███████║█████╔╝ █████╗ [/red]", + "[red] ██║╚██╔╝██║██╔══██║██╔═██╗ ██╔══╝ [/red]", + "[red] ██║ ╚═╝ ██║██║ ██║██║ ██╗███████╗[/red]", + "[red] ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝[/red]" + ] + } + ], + "TITLE": [ + { + "ascii": [ + " __ __ _ ", + " | \\/ | __ _| | _____ ", + " | |\\/| |/ _` | |/ / _ \\", + " | | | | (_| | < __/", + " |_| |_|\\__,_|_|\\_\\___|" + ] + } + ], + "STYLE": { + "command_width": 35, + "outer_width": 140, + "primary_color": "red" + }, + "Basics": [ + { + "command": "make", + "description": "Run default target (usually 'all')" + }, + { + "command": "make target_name", + "description": "Run specific target" + }, + { + "command": "make -f custom.mk", + "description": "Use custom Makefile" + } + ], + "Variables": [ + { + "command": "make VAR=value target", + "description": "Pass variable to make" + }, + { + "command": "make -e", + "description": "Use environment variables" + }, + { + "command": "make --print-data-base", + "description": "Print all variables and rules" + } + ], + "Targets": [ + { + "command": "make -n target", + "description": "Show commands without executing" + }, + { + "command": "make -B target", + "description": "Force rebuild (ignore timestamps)" + }, + { + "command": "make clean", + "description": "Run clean target (remove build files)" + } + ], + "Parallel Execution": [ + { + "command": "make -j4", + "description": "Run 4 jobs in parallel" + }, + { + "command": "make -j", + "description": "Run unlimited parallel jobs" + } + ], + "Debugging": [ + { + "command": "make --debug=b", + "description": "Show basic debug info" + }, + { + "command": "make -d", + "description": "Print detailed debug info" + }, + { + "command": "make --version", + "description": "Show make version" + } + ], + "Common Targets": [ + { + "command": "make build", + "description": "Build the project" + }, + { + "command": "make test", + "description": "Run tests" + }, + { + "command": "make install", + "description": "Install built binaries" + }, + { + "command": "make uninstall", + "description": "Remove installed files" + } + ] +} diff --git a/data/nvm.json b/data/nvm.json new file mode 100644 index 0000000..d60cba0 --- /dev/null +++ b/data/nvm.json @@ -0,0 +1,106 @@ +{ + "LOGO": [ + { + "ascii": [ + "[green] ███╗ ██╗██╗ ██╗███╗ ███╗[/green]", + "[green] ████╗ ██║██║ ██║████╗ ████║[/green]", + "[green] ██╔██╗ ██║██║ ██║██╔████╔██║[/green]", + "[green] ██║╚██╗██║╚██╗ ██╔╝██║╚██╔╝██║[/green]", + "[green] ██║ ╚████║ ╚████╔╝ ██║ ╚═╝ ██║[/green]", + "[green] ╚═╝ ╚═══╝ ╚═══╝ ╚═╝ ╚═╝[/green]" + ] + } + ], + "TITLE": [ + { + "ascii": [ + " _ ___ ____ __ ", + " | \\ | \\ \\ / / \\/ |", + " | \\| |\\ \\ / /| |\\/| |", + " | |\\ | \\ V / | | | |", + " |_| \\_| \\_/ |_| |_|" + ] + } + ], + "STYLE": { + "command_width": 35, + "outer_width": 140, + "primary_color": "green" + }, + "Version Management": [ + { + "command": "nvm --version", + "description": "Show NVM version" + }, + { + "command": "nvm list", + "description": "List installed Node versions" + }, + { + "command": "nvm list-remote", + "description": "List available Node versions" + } + ], + "Installation": [ + { + "command": "nvm install node", + "description": "Install latest Node.js" + }, + { + "command": "nvm install 18.16.0", + "description": "Install specific version" + }, + { + "command": "nvm install 18", + "description": "Install latest from major version" + }, + { + "command": "nvm install --lts", + "description": "Install latest LTS version" + } + ], + "Switching Versions": [ + { + "command": "nvm use 18.16.0", + "description": "Switch to specific version" + }, + { + "command": "nvm use node", + "description": "Use latest version" + }, + { + "command": "nvm use --lts", + "description": "Use latest LTS" + } + ], + "Default Version": [ + { + "command": "nvm alias default 18.16.0", + "description": "Set default Node version" + }, + { + "command": "nvm alias default node", + "description": "Use latest as default" + } + ], + "Uninstall": [ + { + "command": "nvm uninstall 18.16.0", + "description": "Remove a Node version" + }, + { + "command": "nvm uninstall node", + "description": "Uninstall latest version" + } + ], + "Aliases": [ + { + "command": "nvm alias myalias 18.16.0", + "description": "Create custom alias" + }, + { + "command": "nvm alias", + "description": "List all aliases" + } + ] +} diff --git a/data/pip.json b/data/pip.json new file mode 100644 index 0000000..ee1ffe5 --- /dev/null +++ b/data/pip.json @@ -0,0 +1,141 @@ +{ + "LOGO": [ + { + "ascii": [ + "[yellow] ██████╗ ██╗██████╗ [/yellow]", + "[yellow] ██╔══██╗██║██╔══██╗[/yellow]", + "[yellow] ██████╔╝██║██████╔╝[/yellow]", + "[yellow] ██╔═══╝ ██║██╔═══╝ [/yellow]", + "[yellow] ██║ ██║██║ [/yellow]", + "[yellow] ╚═╝ ╚═╝╚═╝ [/yellow]" + ] + } + ], + "TITLE": [ + { + "ascii": [ + " ____ _ ", + " | _ \\(_)_ __ ", + " | |_) | | '_ \\ ", + " | __/| | |_) |", + " |_| |_| .__/ ", + " |_| " + ] + } + ], + "STYLE": { + "command_width": 30, + "outer_width": 140, + "primary_color": "blue" + }, + "Installation & Upgrades": [ + { + "command": "pip install package_name", + "description": "Install a package from PyPI" + }, + { + "command": "pip install package_name==1.2.3", + "description": "Install a specific version" + }, + { + "command": "pip install --upgrade pip", + "description": "Upgrade pip itself" + }, + { + "command": "pip install -r requirements.txt", + "description": "Install packages from requirements file" + } + ], + "Package Management": [ + { + "command": "pip list", + "description": "List installed packages" + }, + { + "command": "pip show package_name", + "description": "Show package information" + }, + { + "command": "pip search package_name", + "description": "Search PyPI for packages" + }, + { + "command": "pip uninstall package_name", + "description": "Remove a package" + } + ], + "Version Management": [ + { + "command": "pip install 'package_name>=1.0,<2.0'", + "description": "Install with version range" + }, + { + "command": "pip index versions package_name", + "description": "List available versions of a package" + }, + { + "command": "pip install --upgrade package_name", + "description": "Update package to latest version" + } + ], + "Requirements Files": [ + { + "command": "pip freeze > requirements.txt", + "description": "Generate requirements file from current environment" + }, + { + "command": "pip install -r requirements.txt", + "description": "Install from requirements file" + }, + { + "command": "pip install -r requirements-dev.txt", + "description": "Install development requirements" + } + ], + "Virtual Environments": [ + { + "command": "python -m venv myenv", + "description": "Create a virtual environment" + }, + { + "command": "source myenv/bin/activate", + "description": "Activate venv (Linux/macOS)" + }, + { + "command": "myenv\\Scripts\\activate", + "description": "Activate venv (Windows)" + }, + { + "command": "deactivate", + "description": "Deactivate virtual environment" + } + ], + "Package Inspection": [ + { + "command": "pip show -f package_name", + "description": "Show package files" + }, + { + "command": "pip check", + "description": "Check for broken dependencies" + }, + { + "command": "pip cache info", + "description": "Show pip cache information" + } + ], + "Advanced": [ + { + "command": "pip install -e .", + "description": "Install package in editable mode" + }, + { + "command": "pip install git+https://github.com/user/repo.git", + "description": "Install from Git repository" + }, + { + "command": "pip install --force-reinstall package_name", + "description": "Force reinstall a package" + } + ] +} diff --git a/data/poetry.json b/data/poetry.json new file mode 100644 index 0000000..6f8fe27 --- /dev/null +++ b/data/poetry.json @@ -0,0 +1,123 @@ +{ + "LOGO": [ + { + "ascii": [ + "[cyan] ██████╗ ██████╗ ███████╗████████╗██████╗ ██╗ ██╗[/cyan]", + "[cyan] ██╔══██╗██╔═══██╗██╔════╝╚══██╔══╝██╔══██╗╚██╗ ██╔╝[/cyan]", + "[cyan] ██████╔╝██║ ██║█████╗ ██║ ██████╔╝ ╚████╔╝ [/cyan]", + "[cyan] ██╔═══╝ ██║ ██║██╔══╝ ██║ ██╔══██╗ ╚██╔╝ [/cyan]", + "[cyan] ██║ ╚██████╔╝███████╗ ██║ ██║ ██║ ██║ [/cyan]", + "[cyan] ╚═╝ ╚═════╝ ╚══════╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ [/cyan]" + ] + } + ], + "TITLE": [ + { + "ascii": [ + " ____ _ ", + " | _ \\ ___ ___| |_ _ __ _ _ ", + " | |_) / _ \\ / _ \\ __| '__| | | |", + " | __/ (_) | __/ |_| | | |_| |", + " |_| \\___/ \\___|\\__|_| \\__, |", + " |___/ " + ] + } + ], + "STYLE": { + "command_width": 35, + "outer_width": 140, + "primary_color": "cyan" + }, + "Project Setup": [ + { + "command": "poetry new project_name", + "description": "Create a new poetry project with structure" + }, + { + "command": "poetry init", + "description": "Initialize poetry in current directory" + }, + { + "command": "poetry config --list", + "description": "Show all poetry configurations" + } + ], + "Dependency Management": [ + { + "command": "poetry add package_name", + "description": "Add a dependency to the project" + }, + { + "command": "poetry add --group dev pytest black", + "description": "Add dev dependencies" + }, + { + "command": "poetry add 'package_name>=1.0,<2.0'", + "description": "Add with version constraints" + }, + { + "command": "poetry remove package_name", + "description": "Remove a dependency" + } + ], + "Virtual Environments": [ + { + "command": "poetry install", + "description": "Install dependencies from poetry.lock" + }, + { + "command": "poetry install --no-dev", + "description": "Install without dev dependencies" + }, + { + "command": "poetry env use python3.10", + "description": "Use specific Python version" + }, + { + "command": "poetry env info", + "description": "Show virtual environment info" + } + ], + "Running Code": [ + { + "command": "poetry run python script.py", + "description": "Run command in poetry environment" + }, + { + "command": "poetry shell", + "description": "Activate poetry shell" + } + ], + "Lock & Update": [ + { + "command": "poetry update", + "description": "Update all dependencies" + }, + { + "command": "poetry update package_name", + "description": "Update specific package" + }, + { + "command": "poetry lock", + "description": "Generate lock file" + }, + { + "command": "poetry show", + "description": "Show installed packages" + } + ], + "Building & Publishing": [ + { + "command": "poetry build", + "description": "Build distribution packages" + }, + { + "command": "poetry publish", + "description": "Publish to PyPI" + }, + { + "command": "poetry publish -r test", + "description": "Publish to test repository" + } + ] +} diff --git a/data/rsync.json b/data/rsync.json new file mode 100644 index 0000000..0dee152 --- /dev/null +++ b/data/rsync.json @@ -0,0 +1,103 @@ +{ + "LOGO": [ + { + "ascii": [ + "[cyan] ██████╗ ███████╗██╗ ██╗███╗ ██╗ ██████╗[/cyan]", + "[cyan] ██╔══██╗██╔════╝╚██╗ ██╔╝████╗ ██║██╔════╝[/cyan]", + "[cyan] ██████╔╝███████╗ ╚████╔╝ ██╔██╗ ██║██║ [/cyan]", + "[cyan] ██╔══██╗╚════██║ ╚██╔╝ ██║╚██╗██║██║ [/cyan]", + "[cyan] ██║ ██║███████║ ██║ ██║ ╚████║╚██████╗[/cyan]", + "[cyan] ╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═╝ ╚═══╝ ╚═════╝[/cyan]" + ] + } + ], + "TITLE": [ + { + "ascii": [ + " ____ ", + " | _ \\ ___ _ _ _ __ ___ ", + " | |_) / __| | | | '_ \\ / __|", + " | _ <\\__ \\ |_| | | | | (__ ", + " |_| \\_\\___/\\__, |_| |_|\\___|", + " |___/ " + ] + } + ], + "STYLE": { + "command_width": 35, + "outer_width": 140, + "primary_color": "cyan" + }, + "File Synchronization": [ + { + "command": "rsync -av source/ destination/", + "description": "Sync directories (archive verbose)" + }, + { + "command": "rsync -av --delete source/ destination/", + "description": "Sync and delete extra files in destination" + }, + { + "command": "rsync -avz source/ destination/", + "description": "Sync with compression" + } + ], + "Remote Synchronization": [ + { + "command": "rsync -av source/ user@host:/remote/path/", + "description": "Sync to remote server" + }, + { + "command": "rsync -av user@host:/remote/path/ destination/", + "description": "Sync from remote server" + }, + { + "command": "rsync -av -e ssh source/ user@host:/path/", + "description": "Sync over SSH" + } + ], + "Filtering": [ + { + "command": "rsync -av --exclude='*.log' source/ destination/", + "description": "Exclude file pattern" + }, + { + "command": "rsync -av --include='*.txt' --exclude='*' source/ destination/", + "description": "Include only specific pattern" + }, + { + "command": "rsync -av --filter=':- .gitignore' source/ destination/", + "description": "Use .gitignore rules" + } + ], + "Performance": [ + { + "command": "rsync -av --partial source/ destination/", + "description": "Keep partial transfers (useful for resume)" + }, + { + "command": "rsync -avz --bwlimit=1000 source/ destination/", + "description": "Limit bandwidth to 1000 KB/s" + } + ], + "Dry Run & Testing": [ + { + "command": "rsync -av --dry-run source/ destination/", + "description": "Preview what would be synced" + }, + { + "command": "rsync -av --itemize-changes source/ destination/", + "description": "Show detailed changes" + } + ], + "Advanced": [ + { + "command": "rsync -av --backup --backup-dir=./backups source/ destination/", + "description": "Create backups before overwriting" + }, + { + "command": "rsync -av --checksum source/ destination/", + "description": "Check with checksum instead of timestamp" + } + ] +} diff --git a/data/sdkman.json b/data/sdkman.json new file mode 100644 index 0000000..8a9f9d6 --- /dev/null +++ b/data/sdkman.json @@ -0,0 +1,98 @@ +{ + "LOGO": [ + { + "ascii": [ + "[blue] ███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███╗ ██╗[/blue]", + "[blue] ██╔════╝██╔══██╗██║ ██╔╝████╗ ████║██╔══██╗████╗ ██║[/blue]", + "[blue] ███████╗██║ ██║█████╔╝ ██╔████╔██║███████║██╔██╗ ██║[/blue]", + "[blue] ╚════██║██║ ██║██╔═██╗ ██║╚██╔╝██║██╔══██║██║╚██╗██║[/blue]", + "[blue] ███████║██████╔╝██║ ██╗██║ ╚═╝ ██║██║ ██║██║ ╚████║[/blue]", + "[blue] ╚══════╝╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═══╝[/blue]" + ] + } + ], + "TITLE": [ + { + "ascii": [ + " ____ ____ _ ____ __ _ _ _ ", + " / ___|| _ \\| |/ / \\/ | / \\ | \\ | |", + " \\___ \\| | | | ' /| |\\/| | / _ \\ | \\| |", + " ___) | |_| | . \\| | | |/ ___ \\| |\\ |", + " |____/|____/|_|\\_\\_| |_/_/ \\_\\_| \\_|" + ] + } + ], + "STYLE": { + "command_width": 40, + "outer_width": 140, + "primary_color": "blue" + }, + "Setup & Configuration": [ + { + "command": "curl -s \"https://get.sdkman.io\" | bash", + "description": "Install SDKMAN" + }, + { + "command": "source \"$HOME/.sdkman/bin/sdkman-init.sh\"", + "description": "Initialize SDKMAN" + } + ], + "SDK Listing": [ + { + "command": "sdk list", + "description": "List available SDKs" + }, + { + "command": "sdk list java", + "description": "List available Java versions" + }, + { + "command": "sdk list maven", + "description": "List available Maven versions" + } + ], + "Installation": [ + { + "command": "sdk install java 21-tem", + "description": "Install Java 21 (Temurin)" + }, + { + "command": "sdk install maven 3.9.0", + "description": "Install Maven 3.9.0" + }, + { + "command": "sdk install gradle 8.1.1", + "description": "Install Gradle 8.1.1" + } + ], + "Default Version": [ + { + "command": "sdk default java 21-tem", + "description": "Set Java 21 as default" + } + ], + "Updates & Cleanup": [ + { + "command": "sdk upgrade java", + "description": "Upgrade to latest Java" + }, + { + "command": "sdk uninstall java 20", + "description": "Remove specific version" + }, + { + "command": "sdk selfupdate", + "description": "Update SDKMAN itself" + } + ], + "Offline Mode": [ + { + "command": "sdk offline enable", + "description": "Enable offline mode" + }, + { + "command": "sdk offline disable", + "description": "Disable offline mode" + } + ] +} diff --git a/data/ssh.json b/data/ssh.json new file mode 100644 index 0000000..2133176 --- /dev/null +++ b/data/ssh.json @@ -0,0 +1,128 @@ +{ + "LOGO": [ + { + "ascii": [ + "[green] ███████╗███████╗██╗ ██╗[/green]", + "[green] ██╔════╝██╔════╝██║ ██║[/green]", + "[green] ███████╗███████╗███████║[/green]", + "[green] ╚════██║╚════██║██╔══██║[/green]", + "[green] ███████║███████║██║ ██║[/green]", + "[green] ╚══════╝╚══════╝╚═╝ ╚═╝[/green]" + ] + } + ], + "TITLE": [ + { + "ascii": [ + " ____ ____ _ _ ", + " / ___/ ___|| | | |", + " \\___ \\___ \\| |_| |", + " ___) |__) | _ |", + " |____/____/|_| |_|" + ] + } + ], + "STYLE": { + "command_width": 40, + "outer_width": 140, + "primary_color": "green" + }, + "Connecting": [ + { + "command": "ssh user@host", + "description": "Connect to remote server" + }, + { + "command": "ssh -p 2222 user@host", + "description": "Connect on custom port" + }, + { + "command": "ssh -i /path/to/key user@host", + "description": "Connect using specific key" + } + ], + "Key Management": [ + { + "command": "ssh-keygen -t rsa -b 4096", + "description": "Generate new RSA SSH key" + }, + { + "command": "ssh-keygen -t ed25519", + "description": "Generate ED25519 SSH key (recommended)" + }, + { + "command": "ssh-copy-id -i ~/.ssh/id_rsa.pub user@host", + "description": "Copy public key to remote server" + } + ], + "Key Operations": [ + { + "command": "ssh-keygen -l -f ~/.ssh/id_rsa.pub", + "description": "Show key fingerprint" + }, + { + "command": "ssh-keygen -p -f ~/.ssh/id_rsa", + "description": "Change key passphrase" + }, + { + "command": "ssh-keygen -R hostname", + "description": "Remove host from known_hosts" + } + ], + "SSH Agent": [ + { + "command": "eval $(ssh-agent -s)", + "description": "Start SSH agent" + }, + { + "command": "ssh-add ~/.ssh/id_rsa", + "description": "Add key to SSH agent" + }, + { + "command": "ssh-add -l", + "description": "List keys in SSH agent" + }, + { + "command": "ssh-add -D", + "description": "Remove all keys from agent" + } + ], + "File Transfer": [ + { + "command": "scp file.txt user@host:/remote/path/", + "description": "Copy file to remote server" + }, + { + "command": "scp user@host:/remote/file.txt .", + "description": "Copy file from remote server" + }, + { + "command": "scp -r folder/ user@host:/remote/path/", + "description": "Copy directory recursively" + } + ], + "Tunneling": [ + { + "command": "ssh -L 8080:localhost:80 user@host", + "description": "Local port forwarding" + }, + { + "command": "ssh -R 8080:localhost:80 user@host", + "description": "Remote port forwarding" + }, + { + "command": "ssh -D 1080 user@host", + "description": "Create SOCKS proxy" + } + ], + "Configuration": [ + { + "command": "cat ~/.ssh/config", + "description": "Show SSH config" + }, + { + "command": "ssh-keyscan -H host >> ~/.ssh/known_hosts", + "description": "Add host key to known_hosts" + } + ] +} diff --git a/data/sudo.json b/data/sudo.json new file mode 100644 index 0000000..93f4d16 --- /dev/null +++ b/data/sudo.json @@ -0,0 +1,106 @@ +{ + "LOGO": [ + { + "ascii": [ + "[green] ███████╗██╗ ██╗██████╗ ██████╗ [/green]", + "[green] ██╔════╝██║ ██║██╔══██╗██╔═══██╗[/green]", + "[green] ███████╗██║ ██║██║ ██║██║ ██║[/green]", + "[green] ╚════██║██║ ██║██║ ██║██║ ██║[/green]", + "[green] ███████║╚██████╔╝██████╔╝╚██████╔╝[/green]", + "[green] ╚══════╝ ╚═════╝ ╚═════╝ ╚═════╝ [/green]" + ] + } + ], + "TITLE": [ + { + "ascii": [ + " ____ _ ", + " / ___| _ _ __| | ___ ", + " \\___ \\| | | |/ _` |/ _ \\ ", + " ___) | |_| | (_| | (_) |", + " |____/ \\__,_|\\__,_|\\___/ " + ] + } + ], + "STYLE": { + "command_width": 35, + "outer_width": 140, + "primary_color": "green" + }, + "Running Commands": [ + { + "command": "sudo command", + "description": "Run command as superuser" + }, + { + "command": "sudo -u username command", + "description": "Run command as specific user" + }, + { + "command": "sudo -E command", + "description": "Preserve environment variables" + } + ], + "Password Behavior": [ + { + "command": "sudo -S command", + "description": "Read password from stdin" + }, + { + "command": "sudo -i", + "description": "Interactive shell with login" + }, + { + "command": "sudo -s", + "description": "Interactive shell without login" + } + ], + "Privileges": [ + { + "command": "sudo -l", + "description": "List user's sudo permissions" + }, + { + "command": "sudo -ll", + "description": "List with command details" + }, + { + "command": "sudo -v", + "description": "Update sudo password timeout" + } + ], + "Multiple Commands": [ + { + "command": "sudo command1 && sudo command2", + "description": "Run multiple commands sequentially" + }, + { + "command": "sudo sh -c 'command1 && command2'", + "description": "Run multiple commands in one shell" + } + ], + "Configuration": [ + { + "command": "sudo visudo", + "description": "Edit sudoers file (SAFE)" + }, + { + "command": "sudo -k", + "description": "Invalidate sudo timestamp" + }, + { + "command": "sudo -K", + "description": "Remove timestamp file" + } + ], + "Logging": [ + { + "command": "sudo journalctl --user=sudo", + "description": "View sudo logs" + }, + { + "command": "sudo tail -f /var/log/auth.log", + "description": "Monitor authentication logs" + } + ] +} diff --git a/data/systemctl.json b/data/systemctl.json new file mode 100644 index 0000000..ca53130 --- /dev/null +++ b/data/systemctl.json @@ -0,0 +1,109 @@ +{ + "LOGO": [ + { + "ascii": [ + "[magenta] ███████╗██╗ ██╗███████╗████████╗███████╗███╗ ███╗[/magenta]", + "[magenta] ██╔════╝╚██╗ ██╔╝██╔════╝╚══██╔══╝██╔════╝████╗ ████║[/magenta]", + "[magenta] ███████╗ ╚████╔╝ ███████╗ ██║ █████╗ ██╔████╔██║[/magenta]", + "[magenta] ╚════██║ ╚██╔╝ ╚════██║ ██║ ██╔══╝ ██║╚██╔╝██║[/magenta]", + "[magenta] ███████║ ██║ ███████║ ██║ ███████╗██║ ╚═╝ ██║[/magenta]", + "[magenta] ╚══════╝ ╚═╝ ╚══════╝ ╚═╝ ╚══════╝╚═╝ ╚═╝[/magenta]" + ] + } + ], + "TITLE": [ + { + "ascii": [ + " ____ _ _ _ ", + " / ___| _ _ ___| |_ ___ _ __ ___ __| | | |", + " \\___ \\| | | / __| __/ _ \\ '_ ` _ \\ / _` | | |", + " ___) | |_| \\__ \\ || __/ | | | | | (_| | |_|", + " |____/ \\__, |___/\\__\\___|_| |_| |_|\\__,_| (_)", + " |___/ " + ] + } + ], + "STYLE": { + "command_width": 35, + "outer_width": 140, + "primary_color": "magenta" + }, + "Service Management": [ + { + "command": "systemctl start service_name", + "description": "Start a service" + }, + { + "command": "systemctl stop service_name", + "description": "Stop a service" + }, + { + "command": "systemctl restart service_name", + "description": "Restart a service" + }, + { + "command": "systemctl reload service_name", + "description": "Reload service configuration" + } + ], + "Service Status": [ + { + "command": "systemctl status service_name", + "description": "Show service status" + }, + { + "command": "systemctl is-active service_name", + "description": "Check if service is active" + }, + { + "command": "systemctl is-enabled service_name", + "description": "Check if service is enabled" + } + ], + "Enabling & Disabling": [ + { + "command": "systemctl enable service_name", + "description": "Enable service on boot" + }, + { + "command": "systemctl disable service_name", + "description": "Disable service on boot" + }, + { + "command": "systemctl unmask service_name", + "description": "Unmask a masked service" + }, + { + "command": "systemctl mask service_name", + "description": "Prevent service from being started" + } + ], + "Listing Services": [ + { + "command": "systemctl list-units --type=service", + "description": "List all services" + }, + { + "command": "systemctl list-units --type=service --state=running", + "description": "List running services" + }, + { + "command": "systemctl list-unit-files --type=service", + "description": "List service files" + } + ], + "Troubleshooting": [ + { + "command": "systemctl show service_name", + "description": "Show detailed service info" + }, + { + "command": "journalctl -u service_name", + "description": "View service logs" + }, + { + "command": "journalctl -u service_name -f", + "description": "Follow service logs in real-time" + } + ] +} diff --git a/data/tar.json b/data/tar.json new file mode 100644 index 0000000..635bee3 --- /dev/null +++ b/data/tar.json @@ -0,0 +1,104 @@ +{ + "LOGO": [ + { + "ascii": [ + "[magenta] ████████╗ █████╗ ██████╗ [/magenta]", + "[magenta] ╚══██╔══╝██╔══██╗██╔══██╗[/magenta]", + "[magenta] ██║ ███████║██████╔╝[/magenta]", + "[magenta] ██║ ██╔══██║██╔══██╗[/magenta]", + "[magenta] ██║ ██║ ██║██║ ██║[/magenta]", + "[magenta] ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝[/magenta]" + ] + } + ], + "TITLE": [ + { + "ascii": [ + " _____ ", + " |_ _|_ _ _ __ ", + " | |/ _` | '__|", + " | | (_| | | ", + " |_|\\__,_|_| " + ] + } + ], + "STYLE": { + "command_width": 40, + "outer_width": 140, + "primary_color": "magenta" + }, + "Archiving": [ + { + "command": "tar -cf archive.tar files/", + "description": "Create tar archive" + }, + { + "command": "tar -xf archive.tar", + "description": "Extract tar archive" + }, + { + "command": "tar -tf archive.tar", + "description": "List tar contents" + } + ], + "Compression with tar": [ + { + "command": "tar -czf archive.tar.gz files/", + "description": "Create gzip compressed tar" + }, + { + "command": "tar -xzf archive.tar.gz", + "description": "Extract gzip tar" + }, + { + "command": "tar -cjf archive.tar.bz2 files/", + "description": "Create bzip2 compressed tar" + }, + { + "command": "tar -xjf archive.tar.bz2", + "description": "Extract bzip2 tar" + } + ], + "ZIP Files": [ + { + "command": "zip -r archive.zip folder/", + "description": "Create ZIP archive" + }, + { + "command": "unzip archive.zip", + "description": "Extract ZIP archive" + }, + { + "command": "unzip -l archive.zip", + "description": "List ZIP contents" + }, + { + "command": "unzip -t archive.zip", + "description": "Test ZIP integrity" + } + ], + "Gzip Compression": [ + { + "command": "gzip file.txt", + "description": "Compress file to .gz" + }, + { + "command": "gunzip file.txt.gz", + "description": "Decompress .gz file" + }, + { + "command": "gzip -d file.txt.gz", + "description": "Decompress (alternative)" + } + ], + "Advanced tar": [ + { + "command": "tar -czf - files/ | ssh user@host 'tar -xz -C /remote/path'", + "description": "Compress and pipe to remote" + }, + { + "command": "tar --exclude='*.log' -czf archive.tar.gz folder/", + "description": "Archive excluding patterns" + } + ] +} diff --git a/data/useradd.json b/data/useradd.json new file mode 100644 index 0000000..8abf55a --- /dev/null +++ b/data/useradd.json @@ -0,0 +1,129 @@ +{ + "LOGO": [ + { + "ascii": [ + "[yellow] ██╗ ██╗███████╗███████╗██████╗ [/yellow]", + "[yellow] ██║ ██║██╔════╝██╔════╝██╔══██╗[/yellow]", + "[yellow] ██║ ██║███████╗█████╗ ██████╔╝[/yellow]", + "[yellow] ██║ ██║╚════██║██╔══╝ ██╔══██╗[/yellow]", + "[yellow] ╚██████╔╝███████║███████╗██║ ██║[/yellow]", + "[yellow] ╚═════╝ ╚══════╝╚══════╝╚═╝ ╚═╝[/yellow]" + ] + } + ], + "TITLE": [ + { + "ascii": [ + " _ _ ___ ___ _ __ __ _ __| | __| |", + " | | | / __|/ _ \\ '__/ _` |/ _` |/ _` |", + " | |_| \\__ \\ __/ | | (_| | (_| | (_| |", + " \\__,_|___/\\___|_| \\__,_|\\__,_|\\__,_|" + ] + } + ], + "STYLE": { + "command_width": 35, + "outer_width": 140, + "primary_color": "yellow" + }, + "User Management": [ + { + "command": "sudo useradd username", + "description": "Create new user" + }, + { + "command": "sudo useradd -m -s /bin/bash username", + "description": "Create user with home dir and shell" + }, + { + "command": "sudo userdel username", + "description": "Delete user" + }, + { + "command": "sudo userdel -r username", + "description": "Delete user and home directory" + } + ], + "User Info": [ + { + "command": "id", + "description": "Show current user ID and groups" + }, + { + "command": "id username", + "description": "Show user ID and groups" + }, + { + "command": "finger username", + "description": "Show user information" + }, + { + "command": "who", + "description": "List logged-in users" + } + ], + "Group Management": [ + { + "command": "sudo groupadd groupname", + "description": "Create new group" + }, + { + "command": "sudo groupdel groupname", + "description": "Delete group" + }, + { + "command": "sudo usermod -a -G groupname username", + "description": "Add user to group" + }, + { + "command": "groups username", + "description": "Show user groups" + } + ], + "Password Management": [ + { + "command": "passwd", + "description": "Change current user password" + }, + { + "command": "sudo passwd username", + "description": "Change user password" + }, + { + "command": "sudo usermod -L username", + "description": "Lock user account" + }, + { + "command": "sudo usermod -U username", + "description": "Unlock user account" + } + ], + "Sudo Configuration": [ + { + "command": "sudo visudo", + "description": "Edit sudoers file safely" + }, + { + "command": "sudo -l", + "description": "List user sudo privileges" + }, + { + "command": "sudo -i", + "description": "Switch to root user (interactive)" + } + ], + "File Ownership": [ + { + "command": "chown username file.txt", + "description": "Change file owner" + }, + { + "command": "chown username:groupname file.txt", + "description": "Change owner and group" + }, + { + "command": "chown -R username directory/", + "description": "Recursively change ownership" + } + ] +} diff --git a/data/uv.json b/data/uv.json new file mode 100644 index 0000000..a321ee5 --- /dev/null +++ b/data/uv.json @@ -0,0 +1,110 @@ +{ + "LOGO": [ + { + "ascii": [ + "[magenta] ██╗ ██╗██╗ ██╗[/magenta]", + "[magenta] ██║ ██║██║ ██║[/magenta]", + "[magenta] ██║ ██║██║ ██║[/magenta]", + "[magenta] ██║ ██║╚██╗ ██╔╝[/magenta]", + "[magenta] ╚██████╔╝ ╚████╔╝ [/magenta]", + "[magenta] ╚═════╝ ╚═══╝ [/magenta]" + ] + } + ], + "TITLE": [ + { + "ascii": [ + " _ ___ __", + " | | | \\ \\ / /", + " | | | |\\ V / ", + " | |_| | | | ", + " \\___/ |_| " + ] + } + ], + "STYLE": { + "command_width": 30, + "outer_width": 140, + "primary_color": "magenta" + }, + "Project Initialization": [ + { + "command": "uv init", + "description": "Initialize a new Python project" + }, + { + "command": "uv init --package", + "description": "Initialize a new Python package" + }, + { + "command": "uv init --name myproject", + "description": "Initialize with a specific project name" + } + ], + "Virtual Environments": [ + { + "command": "uv venv", + "description": "Create a virtual environment in the current directory" + }, + { + "command": "uv venv .venv", + "description": "Create a virtual environment at a specific path" + }, + { + "command": "source .venv/bin/activate", + "description": "Activate the virtual environment (Linux/macOS)" + }, + { + "command": ".venv\\Scripts\\activate", + "description": "Activate the virtual environment (Windows)" + } + ], + "Dependency Management": [ + { + "command": "uv add requests numpy", + "description": "Add dependencies to the project" + }, + { + "command": "uv add --dev pytest ruff", + "description": "Add development dependencies" + }, + { + "command": "uv remove package_name", + "description": "Remove a dependency from the project" + }, + { + "command": "uv lock", + "description": "Generate or update the lock file" + } + ], + "Dependency Installation": [ + { + "command": "uv sync", + "description": "Sync dependencies from lock file" + }, + { + "command": "uv pip install package_name", + "description": "Install packages with pip-like interface" + } + ], + "Running Code": [ + { + "command": "uv run python script.py", + "description": "Run a Python script with project dependencies" + }, + { + "command": "uv run mycommand", + "description": "Run a command script defined in pyproject.toml" + } + ], + "Building & Publishing": [ + { + "command": "uv build", + "description": "Build the project distribution" + }, + { + "command": "uv publish", + "description": "Publish the project to PyPI" + } + ] +}