Crates.io | termutils |
lib.rs | termutils |
version | 0.1.0 |
source | src |
created_at | 2024-05-27 10:09:56.981569 |
updated_at | 2024-05-27 10:09:56.981569 |
description | All your favourite utilities in one place. |
homepage | |
repository | https://github.com/d33pster/termutils |
max_upload_size | |
id | 1253237 |
size | 68,546 |
termutils
brings all your favourite command line tools in one place.
cls
gst
gcl
cls
The windows cls
command can now be used in Linux/MacOS without ruining the vibe and feel of Linux/MacOS.
$ cls
last login: 2024-05-27 14:22:40.473684 +05:30
(@_@) XXXXX@XXXX termutils %
gst
gst
is a short form for git status coded in rust with better formatting and focusing mainly on the files.
$ gst
on branch: main
Modified\
Cargo.toml
README.md
Ignored\
Cargo.lock, target/
gcl
gcl
being an upgrade to the classic git clone
command is a great tool for cloning repositories.
Documentation of gcl
can be found here.
$ gcl help
gcl v1.0
Help Text
syntax: $ gcl [options] username repo <optional-destination-dir> [flags]
| [Options]
| help -> show help and exit.
| version -> show version and exit.
| [Flags]
| --priv -> for private repos, add this flag.
Custom callable commands can be created using termutils. The code for the same can be written in the terminal with shell code.
$ term help
termutils v0.1.0
HELP
| OPTIONS |
| help or -h : show this help text and exit
| license or -l : show license and exit
| version or -v : show version and exit
| create or -c : create terminal utilities
| SUBOPTIONS (for create) |
| callable or -cal : create a callable command for any application
| SUBOPTIONS (for callable) |
| init or -i : initialise callables
...
# initialise callables
$ term create callable init
Initialised termutils for /Users/XXXX/.zshrc
$ term create callable
Command name: print hello world
Command nickname: hello world
Command Description (optional, press ENTER/RETURN for default): prints hello world in the terminal
Enter your command body here (shell):
echo "hello, world!"
END
Created command hello_world
-> /Users/d33pster/.termutils
Restart Terminal!
$ hello_world
hello, world!
Initialize callables (one time only).
Enter the name of the command.
Enter the nickname or the name you want to call from the terminal. NOTE: if there are more than two words, it
_
will be added in between them.
Add an optional description or just press RETURN/ENTER for default description.
You need to type the shell code for the command line by line and once you are done, type
END
in a new line and press ENTER/RETURN.
NOTE: Do not add
function function_name() {}
. Just write the body.
All done. Restart the terminal to start using your command.
MacOS applications cannot be called directly from the terminal, but a callable command can be created so that they can be opened via terminal.
Here's how:
$ term help
termutils v0.1.0
HELP
| OPTIONS |
| help or -h : show this help text and exit
| license or -l : show license and exit
| version or -v : show version and exit
| create or -c : create terminal utilities
| SUBOPTIONS (for create) |
| callable or -cal : create a callable command for any application
| SUBOPTIONS (for callable) |
| init or -i : initialise callables
| application or -app : callable command for an application
| system or sys : to specify if the app is a system app.
| SYNTAX |
$ term create callable init # need to be run before callables can be created.
$ term create callable -app <appname> <nickname> <optional-system-flag>
[COMMANDS]
cls : clear the screen
gst : git status
gcl : git clone
# first usage only
$ term create callable init
Initialised termutils for /Users/XXXX/.zshrc
# general syntax
term create callable <app-flag> <app-name> <nickname> <sys-flag>
# Here, the app-flag tells the termutils you are creating a callable command for an Application.
# app-name should be same as the one you can see in the /Applications folder.
# nickname arg is optional, if not passed, it will be prompted anyway. This nickname will be the command that you can call in the terminal. NOTE: if more than one word is there `_` will be added in place of a white space.
# finally, if you the Application is a system app like the App Store, you need to add a sys-flag. else no need.
# example
# suppose you need to create a callable command for Google Chrome App.
$ term create callable application "Google Chrome" "chrome"
Created Trigger for GOOGLE CHROME as CHROME
Restart terminal!
# example
# suppose its a system app:
$ term create callable application "App Store" "store" system
Created Trigger for APP STORE as STORE
Restart terminal!
$ chrome
Opening chrome...
done.
$ store
Opening store...
done.
All the long arguments are used in the examples, feel free to use the shorter version of the arguments or a mixture of them.
To create similar argument parsing in your own rust project, check out
argrust
.
Suggestions and Contributions are welcome, submit an issue here or create a pull request here.