Skip to content

Commit

Permalink
Merge pull request #51 from hwixley/feature/no-ref/dynamic-command-in…
Browse files Browse the repository at this point in the history
…fo-generation

Auto-updating command info and readme
  • Loading branch information
hwixley authored Feb 18, 2024
2 parents a23a822 + 28820e7 commit e6098f9
Show file tree
Hide file tree
Showing 16 changed files with 616 additions and 315 deletions.
Binary file modified .generated/wyxcli-output-preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
220 changes: 88 additions & 132 deletions .github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Optimize your development productivity in the terminal

<hr>

[![CODEQL](https://github.com/hwixley/wyx-cli/actions/workflows/github-code-scanning/codeql/badge.svg)](https://hwixley.github.io/wyx-cli/) [![Deploy Jekyll GH-Pages](https://github.com/hwixley/WYX-CLI/actions/workflows/jekyll-gh-pages.yml/badge.svg)](https://github.com/hwixley/WYX-CLI/actions/workflows/jekyll-gh-pages.yml) [![Generate Stdout Image](https://github.com/hwixley/WYX-CLI/actions/workflows/main.yml/badge.svg)](https://github.com/hwixley/WYX-CLI/actions/workflows/main.yml)<br>![License](https://img.shields.io/badge/License-MIT-purple?labelColor=gray&style=flat) ![Version](https://img.shields.io/badge/Version-3.1.0-blue?labelColor=gray&style=flat) ![Shell Support](https://img.shields.io/badge/Shell%20Support-BASH%20&%20ZSH-orange?labelColor=gray&style=flat) ![Operating Systems](https://img.shields.io/badge/OS%20Support-Debian%20Distros%20&%20MacOS-mediumpurple?labelColor=gray&style=flat)
[![CODEQL](https://github.com/hwixley/wyx-cli/actions/workflows/github-code-scanning/codeql/badge.svg)](https://hwixley.github.io/wyx-cli/) [![Deploy Jekyll GH-Pages](https://github.com/hwixley/WYX-CLI/actions/workflows/jekyll-gh-pages.yml/badge.svg)](https://github.com/hwixley/WYX-CLI/actions/workflows/jekyll-gh-pages.yml) [![Generate Stdout Image](https://github.com/hwixley/WYX-CLI/actions/workflows/main.yml/badge.svg)](https://github.com/hwixley/WYX-CLI/actions/workflows/main.yml)<br>![License](https://img.shields.io/badge/License-MIT-purple?labelColor=gray&style=flat) ![Version](https://img.shields.io/badge/Version-3.1.1-blue?labelColor=gray&style=flat) ![Shell Support](https://img.shields.io/badge/Shell%20Support-BASH%20&%20ZSH-orange?labelColor=gray&style=flat) ![Operating Systems](https://img.shields.io/badge/OS%20Support-Debian%-based%20Distros%20&%20MacOS-mediumpurple?labelColor=gray&style=flat)

<hr>
<p align="center">
Expand All @@ -26,23 +26,6 @@ Optimize your development productivity in the terminal
- [Factory-reset Installation](#factory-reset-installation)
- [List of Commands](#list-of-commands)
- [Defaults](#defaults)
- [Navigation](#navigation)
- [Code Editing](#code-editing)
- [Custom Script/Environment Execution](#custom-scriptenvironment-execution)
- [Git Automation](#git-automation)
- [Quick-access URLs](#quick-access-urls)
- [Data for Custom Scripting Logic](#data-for-custom-scripting-logic)
- [Editing Data for Custom Scripting Logic](#editing-data-for-custom-scripting-logic)
- [Env/Keystore Management](#envkeystore-management)
- [File Utilities](#file-utilities)
- [Network Utilities](#network-utilities)
- [Image Utilities](#image-utilities)
- [Text Utilities](#text-utilities)
- [Web Utilities](#web-utilities)
- [Miscellaneous Utilities](#miscellaneous-utilities)
- [Help Utilities](#help-utilities)
- [Bugs, New Features, \& Questions](#bugs-new-features--questions)
- [Make A Contribution](#make-a-contribution)

<hr>

Expand Down Expand Up @@ -147,117 +130,90 @@ Please note any command with an argument in angle brackets below (ie. `<branch>`
<i>**\*\*Note: all commands below should be preceded by the `wyx` command, this was ommitted for readability.\*\***</i>
<br>
### Navigation
1. `cd <mydir>`: directory navigation using custom aliases stored in `mydirs`
2. `back`: go back to last directory
<!-- ### Directory Management
1. `new <mydir> <subdir>`: create new directory in location of alias
2. `delete <mydir> <subdir>`: delete directory in location of alias
3. `hide <mydir> <subdir>`: hide directory in location of alias -->
### Code Editing
1. `vsc <mydir>`: open location of alias in Visual Studio Code
### Custom Script/Environment Execution
1. `run <myscript>`: setup and run the script saved under the given script alias
### Git Automation
1. `push <branch?>`: push changes to the given repository branch (prompts you to enter a commit message on execution and leaves a default message if left empty)
2. `pull <branch?>`: pull changes from the given repository branch
3. `ginit <newdir?>`: initialize git repository in current directory if `<newdir>` is not set, otherwise, a new directory is created called `<newdir>` and a git repository is initialized there instead
<!-- 4. `gnew <mydir/org> <repo>`: create and initialize a new directory as a git repository -->
4. `nb <name?>`: create a new branch
5. `pr`: create a PR against the default branch from the current branch
6. `bpr <name?>`: checkout changes to a new branch and create a PR from this branch
7. `commits`: view detailed commit history
8. `lastcommit`: view last commit
### Quick-access URLs
1. `repo`: go to the respective GitHub repository url on the default branch from your current directory
2. `branch`: go to the respective GitHub repository url on the current branch from your current directory
3. `prs`: go to the Pull Requests page for the respective GitHub repository url from your current directory
4. `actions`: go to the Action Workflows page for the respective GitHub repository url from your current directory
5. `issues`: go to the Issues page for the respective GitHub repository url from your current directory
6. `notifs`: go to your GitHub Notifications
7. `profile`: go to your GitHub profile
8. `org <myorg?>`: go to the specified url of the GitHub organization
9. `help`: go to the wyx-cli GitHub Pages url for documentation
### Data for Custom Scripting Logic
1. `user`: displays stored user-specific data such as: `username` - which represents the user's GitHub username (for configuring GitHub urls), `name` - for software licensing copyright clauses (when setting up GitHub software licenses for your repositories)
2. `myorgs`: displays stored aliases for user's GitHub organizations (for configuring GitHub urls). Please note you can use the `default` alias for your most commonly used organization, allowing you to not have to type the organization alias in cases where a `<myorg?>` argument is present
3. `mydirs`: displays stored aliases for user's directories (for efficient terminal navigation)
4. `myscripts`: displays stored aliases for user's custom scripts (for efficient environment setup or script execution)
### Editing Data for Custom Scripting Logic
1. `editd <data>`: allows the user to edit the specified piece of data (`user`, `myorgs`, `mydirs`, `myscripts`, or `todo`)
2. `edits <myscript>`: allows the user to edit the specified script (this edits the script referenced from the alias stored in `myscripts` not the `myscripts` aliases data)
3. `newscript <script-name?>`: allows the user to create a new script
### Env/Keystore Management
1. `keystore <key> <value?>`: this allows you to add a key-value pair to your '.env' keystore
2. `setup openai_key`: this allows you to use `ask-gpt` and smart commit features which use OpenAI's API.
3. `setup smart_commit`: this allows you to use OpenAI's ChatGPT to write commit messages for you (using `git diff` and `git status` outputs). <i>This requires an OpenAI API key.</i>
### File Utilities
1. `fopen`: open the current directory in your native files application
2. `find <fname>.<fext>`: find a file inside the current directory with the respective name (use `find "*.<ext>"` for finding all files with the given extension)
3. `encrypt <dirname|fname?>`: GPG encrypt a file/directory (saves a new .gpg file)
4. `decrypt <fname?>`: GPG decrypt a file (must be a .gpg file)
### Network Utilities
1. `ip`: get local and public IP addresses of your computer
2. `wifi`: lists details about available wifi networks on your host machine
3. `wpass`: lists your saved wifi passwords
4. `speedtest`: run a network speedtest
5. `hardware-ports`: list your hardware network ports
### Image Utilities
1. `genqr <url?> <fname?>`: generate a png QR code for the specified URL
2. `upscale <fname?> <scale?>`: upscale an image's resolution (**does not smooth interpolated pixels**)
### Text Utilities
1. `genpass <pass-length>`: generate and copy random password string (includes punctuation, digits, upper/lowercase ASCII) of specified length (of default length 16)
2. `genhex <hex-length?>`: generate and copy random hex string of specified length (of default length 32)
3. `genb64 <base64-length?>`: generate and copy random base64 string of specified length (of default length 32)
4. `copy <string?|cmd?>`: copy a string or the output of a shell command (using $(<cmd>) syntax) to your clipboard
5. `lastcmd`: copy the last command you ran to your clipboard
### Web Utilities
1. `webtext`: extract readable text from a website
### Miscellaneous Utilities
1. `weather <city?>`: get the weather for your current/specified location
2. `moon`: get the current moon phase
3. `leap-year`: tells you the next leap year
### Help Utilities
1. `explain "<cmd?>"`: explain the syntax of the specified bash command
2. `ask-gpt`: start a conversation with OpenAI's ChatGPT in the terminal. <i>This requires an OpenAI API key.</i>
3. `google <query?>`: google a query
<hr>
## Bugs, New Features, & Questions
Please post bug reports and new features in the issues section - there are custom templates you can use for each of these. And please post any questions you may have in the discussion section, I will reply to these as soon as I can! :)
<hr>
## Make A Contribution
Contributions are welcome! Pick up a ticket from the Issues section and link it in your PR, I will review it when I can!
### VERSION:
- `version`: WYX-CLI Version
### SYSTEM:
- `sys-info`: Get Shell Type
### DEPENDENCIES:
- `install-deps`: Install WYX-CLI dependencies
- `update-deps`: Update the project dependencies
- `list-deps`: List the project dependencies
### DIRECTORY NAVIGATION:
- `cd`: Navigate Directory Aliases
- `back`: Go Back A Directory
### CODE:
- `run`: Run Script Aliases
- `vsc`: Open Directory Aliases in VSCode
### GIT AUTOMATION:
- `ginit`: Initialise Git Repository
- `push`: Add-Commit-Push Git Changes to Current Branch
- `pull`: Pull Git Changes for Current Branch
- `mpull`: Checkout-Pull Git Changes From Master/Main Branch
- `repo`: View Your Repository On GitHub
- `branch`: View Your Current Branch On GitHub
- `actions`: View Your Repository Actions On GitHub
- `issues`: View Your Repository Issues On GitHub
- `prs`: View Your Repository PRs On GitHub
- `notifs`: View Your GitHub Notifications
- `commits`: View Your Branch Git Commits
- `lastcommit`: View Your Last Commit & Copy It's ID
- `nb`: Checkout-Add-Commit-Push A New Git Branch
- `pr`: Open A Pull Request From Your Current Git Branch on GitHub
- `bpr`: Checkout-Add-Commit-Push A New Git Branch & Open A PR For It On GitHub
- `profile`: View Your GitHub Profile
- `org`: View Your GitHub Organisation
- `pp`: Pull-Push Git Changes to Current Branch
### MY DATA:
- `user`: View Your User Configuration
- `mydirs`: View Your Directory Aliases Configuration
- `myorgs`: View Your GitHub Organisation Configuration
- `myscripts`: View Your Scripts Configuration
- `todo`: View Your To-Do List
### MANAGE MY DATA:
- `editd`: Edit Your WYX-CLI Configuration
- `edits`: Edit A Script File
- `newscript`: Create A New Script
### ENV/KEYSTORE:
- `keystore`: Add a key-value pair to your '.env' keystore
- `setup`: Setup WYX-CLI Third Party API-based utilities
### FILE UTILITIES:
- `find`: Regex Search Current Directory For File
- `fopen`: Open current directory in your files application
- `encrypt`: Encrypt a file using GPG
- `decrypt`: Decrypt a GPG-encrypted file
### NETWORK UTILITIES:
- `ip`: View Your Local & Public IPs
- `wifi`: View Available WiFi Networks
- `hardware-ports`: View Your Hardware Ports
- `wpass`: View Your Saved WiFi Passwords
- `speedtest`: Run A Speed Test On Your Network
### IMAGE UTILITIES:
- `genqr`: Generate a QR code from a URL
- `upscale`: Scale up an image (uses no smoothing)
### TEXT UTILITIES:
- `genpass`: Generate A Random Password
- `genhex`: Generate A Random Hex String
- `genb64`: Generate A Random Base64 String
- `lastcmd`: Copy Your Last Command To Your Clipboard
- `copy`: Copy output of a command to clipboard
### WEB UTILITIES:
- `webtext`: Read-only websites in your terminal
### HELP UTILITIES:
- `help`: View WYX-CLI Documentation
- `explain`: Explain a bash command
- `ask-gpt`: Start a conversation with ChatGPT
- `google`: Google a query
132 changes: 132 additions & 0 deletions .github/README_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
# ⚡️ WYX CLI ⚡️

Optimize your development productivity in the terminal

<hr>

[![CODEQL](https://github.com/hwixley/wyx-cli/actions/workflows/github-code-scanning/codeql/badge.svg)](https://hwixley.github.io/wyx-cli/) [![Deploy Jekyll GH-Pages](https://github.com/hwixley/WYX-CLI/actions/workflows/jekyll-gh-pages.yml/badge.svg)](https://github.com/hwixley/WYX-CLI/actions/workflows/jekyll-gh-pages.yml) [![Generate Stdout Image](https://github.com/hwixley/WYX-CLI/actions/workflows/main.yml/badge.svg)](https://github.com/hwixley/WYX-CLI/actions/workflows/main.yml)<br>![License](https://img.shields.io/badge/License-MIT-purple?labelColor=gray&style=flat) ![Version](https://img.shields.io/badge/Version-@VERSION@-blue?labelColor=gray&style=flat) ![Shell Support](https://img.shields.io/badge/Shell%20Support-BASH%20&%20ZSH-orange?labelColor=gray&style=flat) ![Operating Systems](https://img.shields.io/badge/OS%20Support-Debian%-based%20Distros%20&%20MacOS-mediumpurple?labelColor=gray&style=flat)

<hr>
<p align="center">
<img src="../.generated/wyxcli-output-preview.png" style="width: 90%; display: flex; margin: auto">
</p>

<hr>

## Table of Contents

- [⚡️ WYX CLI ⚡️](#️-wyx-cli-️)
- [Table of Contents](#table-of-contents)
- [What It Does](#what-it-does)
- [Why It Was Made](#why-it-was-made)
- [Support This Project](#support-this-project)
- [Dependencies](#dependencies)
- [Installation](#installation)
- [Extra Feature Setup](#extra-feature-setup)
- [Factory-reset Installation](#factory-reset-installation)
- [List of Commands](#list-of-commands)
- [Defaults](#defaults)

<hr>

## What It Does

Provides developers with the ability for optimising the execution of commonly performed tasks, commands, directory navigations, and environment setups/script executions.

### Why It Was Made

I found myself executing the same commands repeatedly, finding navigation on the terminal for frequently accessed locations needlessly slow, and the task of pushing out new code via manually submitting a PR on my browser repetitive and time-wasting. I decided to start developing my own bash script to help alleviate these issues, and realized the whole world of opportunity I had to help optimize my own daily workflows on the terminal.

I knew I was not the only one who had suffered from these productivity issues as my co-workers saw interest in the tool I was developing. Upon this I decided to start developing a more generic and robust version of my original tool to allow developers across the world optimize their productivity with this tool too!

<hr>

## Support This Project

I am developing this project in my spare time to help developer's across the globe maximize their productivity in the terminal. If you have found this tool useful please leave a star on this repository it really helps me out! I also have a [buymeacoffee](https://www.buymeacoffee.com/hwixley) sponsor link if you would like to help me to continue to be able to develop OSS in spare time by helping me stay caffeinated and coding. :coffee: :zap:

<hr>

## Dependencies

<ins>The dependencies include:</ins>

- `openssl` for the [Random String Generation](https://github.com/hwixley/wyx-cli#text-utilities) commands.
- `git` for all [Git Automation](https://github.com/hwixley/wyx-cli#git-automation) commands.
- Visual Studio Code for the `vsc` code editor command.
- XCode for the `xc` code editor command (only available for Macintosh systems).
- `speedtest` (the Ookla speedtest-cli) for runnning network speed tests. The installation commands for this on MacOS and Debian are in `setup.sh`.

<hr>

## Installation

1. Clone this repository into a folder of your choice:

```
git clone git@github.com:hwixley/WYX-CLI.git
```

2. Navigate into the directory:

```
cd WYX-CLI
```

3. Give permissions to the setup script and run it:

```
chmod +x setup.sh && ./setup.sh
```

4. Reopen your terminal or run `source ~/.bashrc` (`source ~/.zshrc` for unix systems)

Type `wyx` to see the list of commands and start developing some magic!

## Extra Feature Setup

1. You can use OpenAI's ChatGPT to write commit messages for you (using `git diff` and `git status` outputs) when using the `wyx push` command. <i>This requires an OpenAI API key.</i>

```
wyx setup smart_commit
```

## Factory-reset Installation

1. Remove your installation

```
rm -rf <path-of-installation>
```

1. Remove the wyx-cli script setup in your environment file
- Open the file in an editor: (`~/.bashrc` for linux systems, and `~/.zshrc` for unix systems)
```
gedit ~/.bashrc
```
If `gedit` is not available you can always use vim instead:
```
vi ~/.bashrc
```
- Remove the 2 lines for the wyx-cli:<br>
- The first line is a comment: `# WYX-CLI`<br>
- The second line is where the command is actually setup: `alias wyx="<path-of-installation>/wyx-cli.sh"`
2. Follow the [installation instructions](https://github.com/hwixley/wyx-cli#installation)
<hr>
## List of Commands
Please note any command with an argument in angle brackets below (ie. `<branch>`) denotes a dynamic variable which is given by the user. If the text inside these angle has a `?` character at the end (ie. `<branch?>`) this denotes that this argument is optional and if left empty will fallback to the default.
#### Defaults
- `<branch?>` : if left empty the current branch will be used
- `<org?>` : if left empty the default GitHub organisation set in `myorgs` will be used
- Any other optional arguments that you omit will be prompted upon execution
<br>
<i>**\*\*Note: all commands below should be preceded by the `wyx` command, this was ommitted for readability.\*\***</i>
<br>
Loading

0 comments on commit e6098f9

Please sign in to comment.