Skip to content

Commit

Permalink
Merge pull request #107 from Avivbens/network-module-support
Browse files Browse the repository at this point in the history
  • Loading branch information
Avivbens authored Aug 21, 2024
2 parents 7360b82 + b284e62 commit 19c70de
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/app/commands/shell.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions src/commands/shell/config/shell-modules.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`,
Expand Down
21 changes: 21 additions & 0 deletions zsh/extends/.zshrc.extends.network.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#! /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""
alias pubip="curl -s http://whatismyip.akamai.com"

0 comments on commit 19c70de

Please sign in to comment.