From 32dccbf1310acfd525da10dbacbc1937f93ee6bf Mon Sep 17 00:00:00 2001 From: Aviv Ben Shahar Date: Tue, 30 Jul 2024 15:12:23 +0300 Subject: [PATCH 1/2] fix: support network shell module --- docs/app/commands/shell.md | 1 + .../shell/config/shell-modules.config.ts | 5 +++++ zsh/extends/.zshrc.extends.network.sh | 20 +++++++++++++++++++ 3 files changed, 26 insertions(+) create mode 100755 zsh/extends/.zshrc.extends.network.sh diff --git a/docs/app/commands/shell.md b/docs/app/commands/shell.md index 8b5098e3..83337141 100755 --- a/docs/app/commands/shell.md +++ b/docs/app/commands/shell.md @@ -32,6 +32,7 @@ Enable / disable the modules according to your preferences, by using the arrow k - [GitHub CLI](https://github.com/Avivbens/shell-config/tree/HEAD/zsh/extends/.zshrc.extends.github.sh) - [VSCode](https://github.com/Avivbens/shell-config/tree/HEAD/zsh/extends/.zshrc.extends.vscode.sh) - [Npm](https://github.com/Avivbens/shell-config/tree/HEAD/zsh/extends/.zshrc.extends.npm.sh) +- [Network](https://github.com/Avivbens/shell-config/tree/HEAD/zsh/extends/.zshrc.extends.network.sh) - [Angular](https://github.com/Avivbens/shell-config/tree/HEAD/zsh/extends/.zshrc.extends.angular.sh) - [MongoDB](https://github.com/Avivbens/shell-config/tree/HEAD/zsh/extends/.zshrc.extends.mongo.sh) - [Python](https://github.com/Avivbens/shell-config/tree/HEAD/zsh/extends/.zshrc.extends.python.sh) diff --git a/src/commands/shell/config/shell-modules.config.ts b/src/commands/shell/config/shell-modules.config.ts index 5f6f4509..b4645fd1 100755 --- a/src/commands/shell/config/shell-modules.config.ts +++ b/src/commands/shell/config/shell-modules.config.ts @@ -31,6 +31,11 @@ export const SHELL_MODULES_OPTIONS: IShellModule[] = [ path: `${EXTENDS_MODULES_DIR_PATH}/.zshrc.extends.npm.sh`, description: 'NPM aliases and functions', }, + { + name: 'Network', + path: `${EXTENDS_MODULES_DIR_PATH}/.zshrc.extends.network.sh`, + description: 'Network helpers', + }, { name: 'Nest', path: `${EXTENDS_MODULES_DIR_PATH}/.zshrc.extends.nest.sh`, diff --git a/zsh/extends/.zshrc.extends.network.sh b/zsh/extends/.zshrc.extends.network.sh new file mode 100755 index 00000000..d3e54312 --- /dev/null +++ b/zsh/extends/.zshrc.extends.network.sh @@ -0,0 +1,20 @@ +#! /usr/bin/env zsh + +function netconnect() { + local name=$1 + local password=$2 + + if [ -z $name ]; then + echo "Please provide a network name" + return 1 + fi + + if [ -z $password ]; then + echo "Please provide a network password" + return 1 + fi + + networksetup -setairportnetwork en0 $name $password +} + +alias netinfo="networksetup -getinfo "Wi-Fi"" From b284e627d376c7594f1ecff0899e176320fbc866 Mon Sep 17 00:00:00 2001 From: Aviv Ben Shahar Date: Thu, 15 Aug 2024 01:17:10 +0300 Subject: [PATCH 2/2] fix: add `pubip` command - find your public IP --- zsh/extends/.zshrc.extends.network.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/zsh/extends/.zshrc.extends.network.sh b/zsh/extends/.zshrc.extends.network.sh index d3e54312..6463edff 100755 --- a/zsh/extends/.zshrc.extends.network.sh +++ b/zsh/extends/.zshrc.extends.network.sh @@ -18,3 +18,4 @@ function netconnect() { } alias netinfo="networksetup -getinfo "Wi-Fi"" +alias pubip="curl -s http://whatismyip.akamai.com" \ No newline at end of file