Skip to content

Latest commit

 

History

History
106 lines (73 loc) · 1.72 KB

README.md

File metadata and controls

106 lines (73 loc) · 1.72 KB

show command build

boilerplate

initiate go module

go mod init github.com/eduardkh/show

get the cobra module and the cobra CLI tool

go get -u github.com/spf13/cobra@latest
go install github.com/spf13/cobra-cli@latest

initiate cobra project (must be the same as the go module show)

cobra-cli init

test the app

go run main.go
go buld .

functionality

add commands

cobra-cli add ip
cobra-cli add interface -p ipCmd

add external command

cobra-cli add external -p ipCmd
go mod tidy

add calc command

cobra-cli add calc -p ipCmd
go mod tidy

add brief command

cobra-cli add brief -p interfaceCmd

add timestamp

cobra-cli add timestamp

show command usage

install the tool from github.com

go install github.com/eduardkh/show@latest

install autocompletion

show completion powershell | Out-String | Invoke-Expression

make autocompletion permanent in PS

# in $PROFILE file
Test-Path $PROFILE
New-Item -path $PROFILE -type file -force
echo "show completion powershell | Out-String | Invoke-Expression" >> $PROFILE

Get-ExecutionPolicy
Set-ExecutionPolicy RemoteSigned # as admin

# revert $PROFILE file and policy
Remove-Item $PROFILE
Set-ExecutionPolicy Restricted # as admin

basic usage

show ip external
# Your external IP is: [public ip]

show ip interface brief
# IP Address      Subnet Mask     MAC Address             IP Enabled      Interface Description
# 192.168.7.50    255.255.255.0   04:7C:16:00:00:00       true            Intel(R) Ethernet Controller (3) I225-V