Skip to content

Commit

Permalink
Merge pull request #45 from hwixley/rename-project
Browse files Browse the repository at this point in the history
Rename project
  • Loading branch information
hwixley authored Jan 28, 2024
2 parents a03cab4 + b819d8d commit 95f83e6
Show file tree
Hide file tree
Showing 59 changed files with 215 additions and 215 deletions.
6 changes: 3 additions & 3 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Contributing to the WIX-CLI
# Contributing to the WYX-CLI

1. Create a fork of WIX-CLI
1. Create a fork of WYX-CLI
2. Pick up one of the issues if not already underway or assigned. Please comment on the issue that you are working on it, to prevent clashing with other developers.
3. Create a PR from your fork into master and assign @hwixley to review it.
4. @hwixley will review it as soon as he can :)

## General Code Practice

- When creating a new command/feature make sure to list it in the list of commands on the `README.md` and the output of the `wix` command in the correct format.
- When creating a new command/feature make sure to list it in the list of commands on the `README.md` and the output of the `wyx` command in the correct format.
36 changes: 18 additions & 18 deletions .github/README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# ⚡️ WIX CLI ⚡️
# ⚡️ WYX CLI ⚡️

Optimize your development productivity in the terminal

<hr>

[![CODEQL](https://github.com/hwixley/wix-cli/actions/workflows/github-code-scanning/codeql/badge.svg)](https://hwixley.github.io/wix-cli/) [![Deploy Jekyll GH-Pages](https://github.com/hwixley/WIX-CLI/actions/workflows/jekyll-gh-pages.yml/badge.svg)](https://github.com/hwixley/WIX-CLI/actions/workflows/jekyll-gh-pages.yml) [![Generate Stdout Image](https://github.com/hwixley/WIX-CLI/actions/workflows/main.yml/badge.svg)](https://github.com/hwixley/WIX-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-2.1.0-blue?labelColor=gray&style=flat) ![Platforms](https://img.shields.io/badge/Platforms-BASH%20&%20ZSH-orange?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.0.0-blue?labelColor=gray&style=flat) ![Platforms](https://img.shields.io/badge/Platforms-BASH%20&%20ZSH-orange?labelColor=gray&style=flat)

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

<hr>

## Table of Contents

- [⚡️ WIX CLI ⚡️](#️-wix-cli-️)
- [⚡️ WYX CLI ⚡️](#️-wyx-cli-️)
- [Table of Contents](#table-of-contents)
- [What It Does](#what-it-does)
- [Why It Was Made](#why-it-was-made)
Expand Down Expand Up @@ -68,8 +68,8 @@ I am developing this project in my spare time to help developer's across the glo

<ins>The dependencies include:</ins>

- `openssl` for the [Random String Generation](https://github.com/hwixley/wix-cli#text-utilities) commands.
- `git` for all [Git Automation](https://github.com/hwixley/wix-cli#git-automation) commands.
- `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`.
Expand All @@ -81,13 +81,13 @@ I am developing this project in my spare time to help developer's across the glo
1. Clone this repository into a folder of your choice:

```
git clone [email protected]:hwixley/WIX-CLI.git
git clone [email protected]:hwixley/WYX-CLI.git
```

2. Navigate into the directory:

```
cd WIX-CLI
cd WYX-CLI
```

3. Give permissions to the setup script and run it:
Expand All @@ -98,14 +98,14 @@ chmod +x setup.sh && ./setup.sh

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

Type `wix` to see the list of commands and start developing some magic!
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 `wix push` command. <i>This requires an OpenAI API key.</i>
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>

```
wix setup smart_commit
wyx setup smart_commit
```

## Factory-reset Installation
Expand All @@ -116,7 +116,7 @@ wix setup smart_commit
rm -rf <path-of-installation>
```

1. Remove the wix-cli script setup in your environment file
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
Expand All @@ -125,10 +125,10 @@ rm -rf <path-of-installation>
```
vi ~/.bashrc
```
- Remove the 2 lines for the wix-cli:<br>
- The first line is a comment: `# WIX-CLI`<br>
- The second line is where the command is actually setup: `alias wix="<path-of-installation>/wix-cli.sh"`
2. Follow the [installation instructions](https://github.com/hwixley/wix-cli#installation)
- 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>
Expand All @@ -144,7 +144,7 @@ Please note any command with an argument in angle brackets below (ie. `<branch>`
<br>
<i>**\*\*Note: all commands below should be preceded by the `wix` command, this was ommitted for readability.\*\***</i>
<i>**\*\*Note: all commands below should be preceded by the `wyx` command, this was ommitted for readability.\*\***</i>
<br>
### Navigation
Expand Down Expand Up @@ -187,7 +187,7 @@ Please note any command with an argument in angle brackets below (ie. `<branch>`
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 wix-cli GitHub Pages url for documentation
9. `help`: go to the wyx-cli GitHub Pages url for documentation
### Data for Custom Scripting Logic
Expand Down
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Pull Request Checks
- [ ] An appropriate title prefix (`[BUG-FIX]`, `[NEW-FEATURE]`,`[REFINEMENT]`, `[METADATA]`) and title have been used.
- [ ] Documentation has been updated on the README and `wix` command output where necessary.
- [ ] Documentation has been updated on the README and `wyx` command output where necessary.

# What changes have been made

Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ jobs:
# Run the script
- name: Run script file
run: |
chmod +x wix-cli.sh
./wix-cli.sh img_stdout
chmod +x wyx-cli.sh
./wyx-cli.sh img_stdout
shell: bash

# Commit and push changes
- name: Commit changes
run: |
git config --local user.name "WIX-CLI Bot"
git config --local user.name "WYX-CLI Bot"
git config --local user.email "[email protected]"
git add .generated/wixcli-output-preview.png
git commit -m "GH-Action: Update 'wix' stdout image"
git add .generated/wyxcli-output-preview.png
git commit -m "GH-Action: Update 'wyx' stdout image"
git push
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.wix-cli-data/
wix-cli-template.sh
.wyx-cli-data/
wyx-cli-template.sh
*.pyc
20 changes: 10 additions & 10 deletions argparse.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#!/bin/bash

# CLI CONSTS
version="2.1.0"
version="3.0.0"
num_args=$#
date=$(date)
year="${date:24:29}"

# Load bash classes
source $WIX_DIR/src/classes/sys/sys.h
source $WYX_DIR/src/classes/sys/sys.h
sys sys
source $WIX_DIR/src/classes/wgit/wgit.h
source $WYX_DIR/src/classes/wgit/wgit.h
wgit wgit
source $WIX_DIR/src/classes/wixd/wixd.h
wixd wixd
source $WYX_DIR/src/classes/wyxd/wyxd.h
wyxd wyxd

# Load source git data
branch=""
Expand All @@ -26,15 +26,15 @@ repo_url=${repo_url%".git"}

if [ $num_args -eq 0 ]; then
# No input - show command info
wixd.command_info
wyxd.command_info

else
source $WIX_DIR/src/classes/cmd/cmd.h
source $WYX_DIR/src/classes/cmd/cmd.h
# Parse input into command object and run it (if valid)
cmd inputCommand
inputCommand.id '=' $1

inputCommand_path="${WIX_DIR}/src/commands/$(inputCommand.path).sh"
inputCommand_path="${WYX_DIR}/src/commands/$(inputCommand.path).sh"

if [ -f "${inputCommand_path}" ]; then
# Valid command found - run it
Expand All @@ -44,8 +44,8 @@ else
else
# Invalid command - show error message
sys.error "Invalid command! Try again"
echo "Type 'wix' to see the list of available commands (and their arguments), or 'wix help' to be redirected to more in-depth online documentation"
echo "Type 'wyx' to see the list of available commands (and their arguments), or 'wyx help' to be redirected to more in-depth online documentation"
fi
fi

unset WIX_DIR WIX_DATA_DIR WIX_SCRIPT_DIR
unset WYX_DIR WYX_DATA_DIR WYX_SCRIPT_DIR
2 changes: 1 addition & 1 deletion completion.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

complete -W "sys-info update install-deps cd back vsc xc run push pull ginit nb pr bpr commits lastcommit setup repo branch prs actions issues notifs profile org help user myorgs mydirs myscripts todo editd edits newscript fopen find regex rgxmatch ip wifi wpass speedtest hardware-ports genqr upscale genhex genb64 copy lastcmd weather moon explain" wix
complete -W "sys-info update install-deps cd back vsc xc run push pull ginit nb pr bpr commits lastcommit setup repo branch prs actions issues notifs profile org help user myorgs mydirs myscripts todo editd edits newscript fopen find regex rgxmatch ip wifi wpass speedtest hardware-ports genqr upscale genhex genb64 copy lastcmd weather moon explain" wyx
24 changes: 12 additions & 12 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ source $(dirname ${BASH_SOURCE[0]})/src/classes/sys/sys.h

setup_alias() {
envfile=$(sys.shell.envfile)
{ echo ""; echo "# WIX CLI"; echo "alias wix=\"source $(pwd)/wix-cli.sh\""; } >> "$envfile"
{ echo ""; echo "# WYX CLI"; echo "alias wyx=\"source $(pwd)/wyx-cli.sh\""; } >> "$envfile"
source "$envfile"
}

setup_completion() {
{ echo ""; echo "# WIX CLI"; echo "source $(pwd)/completion.sh"; } >> "$HOME/.bash_completion"
{ echo ""; echo "# WYX CLI"; echo "source $(pwd)/completion.sh"; } >> "$HOME/.bash_completion"
source "$HOME/.bash_completion"
}

Expand All @@ -31,12 +31,12 @@ fi
sys.info "Installing python dependencies..."
pip3 install -r requirements.txt

sys.info "Setting up wix-cli..."
chmod +x wix-cli.sh
sys.info "Setting up wyx-cli..."
chmod +x wyx-cli.sh


# SETUP METADATA FILES
md_dir=.wix-cli-data
md_dir=.wyx-cli-data
mkdir $md_dir
declare -a files=("git-user.txt" "git-orgs.txt" "dir-aliases.txt" "run-configs.txt" "todo.txt" ".env")
for i in "${files[@]}"; do
Expand Down Expand Up @@ -92,8 +92,8 @@ sys.info "Okay we should be good to go!"

# ADD ALIAS TO ENV FILE
envfile=$(envfile)
if [ "$(alias wix)" != "" ]; then
sys.warn "It looks like you already have a wix alias setup. Would you like to overwrite it? [ y / n ]"
if [ "$(alias wyx)" != "" ]; then
sys.warn "It looks like you already have a wyx alias setup. Would you like to overwrite it? [ y / n ]"
read -r overwrite_alias
if [ "$overwrite_alias" = "y" ]; then
echo "${ORANGE}Please edit the $envfile file manually to remove your old alias${RESET}"
Expand All @@ -108,7 +108,7 @@ completionfile="$HOME/.bash_completion"
if [ -f "$completionfile" ]; then
completion_search=$(cat "$completionfile" | grep -c "$(pwd)/completion.sh")
if [ "$completion_search" != "" ]; then
sys.warn "It looks like you already have wix completion setup. Would you like to overwrite it? [ y / n ]"
sys.warn "It looks like you already have wyx completion setup. Would you like to overwrite it? [ y / n ]"
read -r overwrite_completion
if [ "$overwrite_completion" = "y" ]; then
echo "${ORANGE}Please edit the $HOME/.bashrc file manually to remove your old completion${RESET}"
Expand All @@ -118,18 +118,18 @@ if [ -f "$completionfile" ]; then
setup_completion
fi
else
sys.warn "It looks like you don't have a $HOME/.bash_completion file (allowing you to use the wix command with tab-completion)."
sys.warn "It looks like you don't have a $HOME/.bash_completion file (allowing you to use the wyx command with tab-completion)."
sys.warn "Would you like to create one? [ y / n ]"
read -r create_completion
if [ "$create_completion" = "y" ]; then
touch "$HOME/.bash_completion"
setup_completion
else
sys.error "You need to have a $HOME/.bash_completion file to use wix completion, rerun this setup script if you would like to create one."
sys.error "You need to have a $HOME/.bash_completion file to use wyx completion, rerun this setup script if you would like to create one."
fi
fi

echo ""
sys.info "WIX CLI successfully added to $envfile !"
sys.info "Use 'wix' to get going :)"
sys.info "WYX CLI successfully added to $envfile !"
sys.info "Use 'wyx' to get going :)"
echo ""
14 changes: 7 additions & 7 deletions src/classes/cmd/cmd.class
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
# cmd class - used to parse input into command objects

# load dependencies
. "${WIX_DIR}/src/classes/lib/lib.h"
. "${WYX_DIR}/src/classes/lib/lib.h"
lib lib
. "${WIX_DIR}/src/classes/sys/sys.h"
. "${WYX_DIR}/src/classes/sys/sys.h"
sys sys

# class properties
WIX_cmd="id:"
export WIX_cmd
WYX_cmd="id:"
export WYX_cmd

# class methods
cmd.property(){
if [ "$2" = "=" ]
then
WIX_cmd=$(echo "$WIX_cmd" | sed -E -e "s/$1:[^,]*/$1:$3/g")
WYX_cmd=$(echo "$WYX_cmd" | sed -E -e "s/$1:[^,]*/$1:$3/g")
else
if [[ $WIX_cmd =~ $1:([^,]*) ]]; then
if [[ $WYX_cmd =~ $1:([^,]*) ]]; then
if sys.shell.zsh; then
echo "${match[1]}"
else
Expand Down Expand Up @@ -52,5 +52,5 @@ cmd.args(){
}

cmd.unset(){
unset WIX_cmd
unset WYX_cmd
}
2 changes: 1 addition & 1 deletion src/classes/cmd/cmd.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmd(){
if [[ "$OSTYPE" == "darwin"* ]] || [[ "$(ps -o args= -p $$)" = *"zsh"* ]]; then
. <(sed "s/cmd/$1/g" "${WIX_DIR}/src/classes/cmd/cmd.class")
. <(sed "s/cmd/$1/g" "${WYX_DIR}/src/classes/cmd/cmd.class")
else
. <(sed "s/cmd/$1/g" $(dirname ${BASH_SOURCE[0]})/cmd.class)
fi
Expand Down
2 changes: 1 addition & 1 deletion src/classes/lib/lib.class
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

csv_file="${WIX_DIR}/src/data/arg_scripts.csv"
csv_file="${WYX_DIR}/src/data/arg_scripts.csv"

lib.csv.all(){
lines=$(csvsql --query "select * from arg_scripts where id='$1'" "${csv_file}")
Expand Down
2 changes: 1 addition & 1 deletion src/classes/lib/lib.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
lib(){
if [[ "$OSTYPE" == "darwin"* ]] || [[ "$(ps -o args= -p $$)" = *"zsh"* ]]; then
. <(sed "s/lib/$1/g" "${WIX_DIR}/src/classes/lib/lib.class")
. <(sed "s/lib/$1/g" "${WYX_DIR}/src/classes/lib/lib.class")
else
. <(sed "s/lib/$1/g" $(dirname ${BASH_SOURCE[0]})/lib.class)
fi
Expand Down
2 changes: 1 addition & 1 deletion src/classes/sys/sys.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
sys(){
if [[ "$OSTYPE" == "darwin"* ]] || [[ "$(ps -o args= -p $$)" = *"zsh"* ]]; then
. <(sed "s/sys/$1/g" "${WIX_DIR}/src/classes/sys/sys.class")
. <(sed "s/sys/$1/g" "${WYX_DIR}/src/classes/sys/sys.class")
else
. <(sed "s/sys/$1/g" $(dirname ${BASH_SOURCE[0]})/sys.class)
fi
Expand Down
Loading

0 comments on commit 95f83e6

Please sign in to comment.