`tmax` is a powerful tool to help you get terminal cmd directly.

                             _
                            | |_ _ __ ___   __ ___  __
                            | __| '_ ` _ \ / _` \ \/ /
                            | |_| | | | | | (_| |>  <
                             \__|_| |_| |_|\__,_/_/\_\

What is tmax?

The positioning of tmax is a command line tool with a little artificial intelligence. If you frequently deal with the terminal daily, tmax will greatly improve your work efficiency.

The design idea of tmax

  • Have a local storage as a knowledge base
  • Efficient search algorithm and accurate feedback
  • Full command line interaction
  • Make your very long cmd short

How tmax works?

build tmax

For liunx and macos you can install tmax as follows.

Use make build and you will get tmax in the directory.

chmod +x tmax && cp tmax /usr/local/bin

Install tmax

  • go get If you have golang environment, use go get to install tmax
go get -u github.com/hantmac/tmax
  • brew install For mac os, you can use brew:
brew tap hantmac/tap && brew install --build-from-source tmax
  • binary file If you use unix, you can download binary file to use tmax:
wget https://github.com/hantmac/tmax/releases/download/v0.1.0/tmax_v0.1.0_linux_x86_64.tar.gz && \
tar -zxvf tmax_v0.1.0_linux_x86_64.tar.gz -C /usr/local/bin && chmod +x /usr/local/bin/tmax

Before using tmax

Then, you need to tmax generate to generate a config file in $HOME/.tmax.yaml and the file look like as follows:

custom:
  check: curl 127.0.0.1:8080/health
k8s:
  filternodecpu: kubectl get nodes -o=jsonpath="{range .items[*]}{.metadata.name}{'\t'}{.status.capacity.cpu}{'\t'}{.status.capacity.memory}{'\n'}{end}"
  filternodetaint: kubectl get nodes -o=jsonpath="{range .items[*]}{.metadata.name}{'\t'}{.spec.taints[*].key}{'\n'}{end}"
  corednsedit: kubectl edit cm coredns -nkube-system
  allnode: kubectl get no
  alldeploy: kubectl get deploy
  allpod: kubectl get pod -A
  busyboxrun: kubectl run busybox --rm -ti --image=busybox /bin/sh
  allnodeip: kubectl get node -o=jsonpath="{range .items[*]}{.metadata.name}{'\t'}{.status.addresses[0].address}{'\n'}{end}"
  podResource: kubectl get pod -o custom-columns=NAME:metadata.name,podIP:status.podIP,hostIp:spec.containers[0].resources
  getns: kubectl get ns
  createdemo: kubectl create deployment nginx --image=nginx
  exposedemo: kubectl expose deployment nginx --port=80
  getnetwork: kubectl get networkpolicy
  runbox: kubectl run busybox --rm -ti --image=busybox /bin/sh
unix:
  "tar": "tar -xjvf test.tar.bz2"

As you can see, there are many long commands those hard to keep in your mind. If you want to quickly get a long command, even if you have memorized it, it takes a long time to type it into the console, not to mention that sometimes you can't remember such a long command.

At this moment, tmax appeared, it will solve the problem just mentioned.

What will tmax bring me?

tmax has 3 mode: directly mode, search mode and interactive mode. And tmax will make your very long terminal cmd short, improve your operation efficiency.

directly mode

If you clearly know the key you want to execute the command, you can use directly mode. Use 'tmxa somekey' , example: tmax check will execute curl 127.0.0.1:8080/health

additional param

First, suppose we define the following short command in the configuration file ~/.tmax.yaml Now I want to see the simple information of a certain pod, just execute:

tmax getpod myapp-deploy

myapp-deploy is a custom parameter, you can even add parameters later:

tmax getpod myapp-deploy -n YOUR_NAMESPACE

You can freely customize your own tmax configuration file according to the required custom parameters.

template parameter

You should notice that custom parameters can only be appended after the tmax command. If you want to add a variable parameter in the middle, you can't use it. For example, if you want to make a taint for a k8s node, and this taint is commonly used by your company, you must execute kubectl taint node node-1.1.1.1reserved=mynode:NoSchedule, and the name of the node will become a variable The parameters and the taint name are fixed, so the good way is to enter the node name to complete the command. Don't panic, tmax supports template parameters. For the above command we can add in ~/.tmax.yaml:

taintnode: kubectl taint node {{.n}} reserved=cd-staging:NoSchedule

Just execute the following content to complete the taint command:

tmax taintnode YOUR_NODE_NAME

search mdoe

If you know the general content of the command you want to execute, you can use the search mode to find and execute it.

Use tmax s CONTENTOFCMD, example: tmax s pod or tmax search pod.

interactive search mode

If you don't want to search, tmax has interactive mode. Just type tmax and enter to interactive mode.

Owner
Jeremy
To be a coder
Jeremy
Similar Resources

The Discord terminal client you never knew you wanted.

The Discord terminal client you never knew you wanted.

I AM CLOSING DOWN THE CORDLESS PROJECT Hey, so I know this is somewhat of a bummer, but I got banned because of ToS violation today. This seemed to be

Jan 7, 2023

yq lets you read YAML files easily on the terminal. You can find key/values easily

yq lets you read YAML files easily on the terminal. You can find key/values easily

yq yq lets you read YAML files easily on the terminal. You can find key/values easily. Motivation Reading yaml configurations for k8s file becomes ard

Nov 2, 2021

A command line tool that builds and (re)starts your web application everytime you save a Go or template fileA command line tool that builds and (re)starts your web application everytime you save a Go or template file

# Fresh Fresh is a command line tool that builds and (re)starts your web application everytime you save a Go or template file. If the web framework yo

Nov 22, 2021

Watch your favourite anime using the video player of your choice directly from the command line

anime-cli Watch your favourite anime using the video player of your choice direc

Feb 10, 2022

A template that help you to quick implement some CLI using Go

db-data-generator This is template that help you to quick implement some CLI using Go. This repository is contains following. minimal CLI implementati

Nov 22, 2021

A dead simple cli utility to help you manage your git stash

A dead simple cli utility to help you manage your git stash

A dead simple cli utility to help you manage your git stash.

Aug 2, 2022

go-editor is the clean go module that refractors from Kubernetes to help you edit resources in a command-line way.

go-editor The source code of go-editor comes from Kubernetes and refractor as the clean Go module. You can embed go-editor in your command-line tool l

Dec 5, 2021

Get random dad jokes on terminal.

Get random dad jokes on terminal.

Dadjokes Get random dad jokes in terminal. This project fetch the icanhazdadjoke API. Installation go get github.com/UltiRequiem/dadjokes Or: go insta

Apr 7, 2022

Get live cricket score right in your terminal.

Get live cricket score right in your terminal.

cric Get cricket score right in your terminal. How to use?! Make sure you have Node.js installed on your machine and just type the following command w

Feb 4, 2022
Comments
  • Support additional parameters

    Support additional parameters

    This PR introduced additional parameters for tmax, you can add your params directly after your shortcut command, for example:

    # set in config
    getpod: kubectl get pod
    
    # run command
    tmax getpod -n test
    
    # it is equal to:
    kubectl get pod -n test
    

    It is enough for most simple commands, but if you want to use some complex commands which do not work in this way, you can also define your own params in config with go template format, for example:

    # set in config
    getpod: kubectl get pod {{.pn}} -n {{.ns}}
    
    # run command
    tmax getpod -pn pod1 -ns test
    
    # it is equal to:
    kubectl get pod pod1 -n test
    

    you can also use template functions like "default":

    # set in config
    getpod: kubectl get pod {{.pn}} -n {{.ns | default "test"}}
    
    # run command
    tmax getpod -pn pod1 -ns newns
    
    # it is equal to:
    kubectl get pod pod1 -n newns
    
    # run command
    tmax getpod -pn pod1
    
    # it is equal to:
    kubectl get pod pod1 -n test
    

    you can use "-", "--", or "=" for your own params, so all the following params are valid: -a b --c d -e=f --g=h -i --j

Related tags
The sntr command-line program gives you convenient access to Sentry directly from your terminal.

sntr: all of Sentry at your fingertips The sntr command-line program gives you convenient access to Sentry directly from your terminal. Disclaimer: th

Jan 31, 2022
Todo-cmd: an app you can add your tasks , edit or delete them

TODO CMD APP! ??‍♂️ Table of contents General info Update Requirements set-up usage General info todo-cmd is an app you can add your tasks , edit or d

Dec 13, 2021
Blocking CMD shell interaction tool.

CliToolkit Blocking command line shell interaction tool. CliToolkit is a small cmd package for Go cmd shell interaction application. Installation # do

Oct 28, 2021
all-in-one cmd tool to search man page of different platform

Overview remote-man is an all-in-one cmd tool to search man page of different platform. support search platform Linux MacOS FreeBSD Installation compi

Oct 31, 2022
It‘s a cmd-line tool like `make` and `task`, supporting nested args and alias using `cobra`

It‘s a cmd-line tool like `make` and `task`, supporting nested args and alias using `cobra`. It's a makefile alternative and a shell wrapper.

Oct 18, 2022
Go cmd utility that prints its command line arguments using strings.Join

Results This is an exercise of the book The Go Programming Language, by Alan A. A. Donovan and Brian Kernighan. Comparison between different versions

Dec 18, 2021
Gostall - Run go install ./cmd/server and not have the binary install in your GOBIN be called server?

GOSTALL Ever wanted to run go install ./cmd/server and not have the binary insta

Jan 7, 2022
A simple library to build golang command line (cli / cmd)apps

A simple library to build golang command line (cli / cmd)apps

Jan 11, 2022
Emlparsingtool - A command line tool that extracts attachments and content directly

A command line tool that extracts attachments and content directly from emL file format messages

Sep 6, 2022
A simple CLI tool to help you manage your CPU

gocpu A simple cli tool to handle and watch your CPU. Usage Usage gocpu [subcommand] [flags] subcommand: watch - see the realtime cpu frequenc

Nov 29, 2021