The term is a Terminal helper utility that provides some very useful functionality. It can execute a command in a new Terminal window at the current directory or a specified directory. With no arguments specified, it opens a new Terminal window at the current directory. If multiple directories are specified then it opens each in a new Terminal window.
This may become a brew recipe at some point in the future.
To install or update term, you can use the install script using cURL:
$ curl -o- https://raw.githubusercontent.com/HR/term/master/install.sh | bash
or Wget:
$ wget -qO- https://raw.githubusercontent.com/HR/term/master/install.sh | bash
The script clones the term repository to /.term and adds the source line to
your profile (/.bash_profile, ~/.zshrc, ~/.profile, or ~/.bashrc).
First clone the repo
$ git clone https://github.com/HR/term.git
Then set up a symlink of 'term' for the script by either sourcing it in your .bash_profile
$ echo "source ~/GitHub/term/term.sh > /dev/null" >> ~/.bash_profile
or if you use zsh
$ echo "source ~/GitHub/term/term.sh > /dev/null" >> ~/.zshrc
or add it to /usr/bin
$ mv ~/GitHub/term/term.sh /usr/bin
$ source ~/.bash_profile # to start using term immediately
To open a new shell at the current path
$ term
To open a specific directory
$ term [path to dir]
To open a multiple specific directories
$ term [dir1 path] [dir2 path] [dir3 path] ... [dirN path]
These will all open in separate new Terminals.
To source ~/.bash_profile or ~/.zshrc (term auto detect what you are using)
$ term -s
To source a specified script
$ term -s [script]
To execute a specified command in a new Terminal at current directory.
$ term -e [command]
To get some help
$ term -h
> term v1.0.0 -- a Terminal helper utility
>
> usage:
> term [-h | --help] [-s script | --source script] [-e command | --exec command] [dir...]
>
> description:
> The term utility provides some very useful functionality. It can execute a
> command in a new Terminal window at the current directory or a specified
> directory. With no arguments specified, it opens a new Terminal window at the
> current directory. If multiple directories are specified then it opens each in a
> new Terminal window.
>
> options:
> -h show this help text
> -v show installed version
> -r open the term GitHub repo to report issue, star, provide feedback...
> -s source ~/.bash_profile or ~/.zshrc (auto detected)
> -s [script] source [script]
> -e [command] execute [command] in new window at current directory
> -e [command] [dir] execute [command] in new window at [dir] directory
>
> examples:
>
> term
>
> will open a new Terminal window at current directory
>
> term ~/Documents
>
> will open a new Terminal window at ~/Documents directory
>
> term ~/Documents ~/Pictures ~/Downloads/
>
> will open new Terminal windows at ~/Documents ~/Pictures ~/Downloads/ directories
>
> term -e echo hi
>
> will open a new Terminal window at current directory and execute "echo hi"
>
> term ~/Desktop -e "echo hi && echo bye"
>
> will open a new Terminal window at ~/Desktop directory and execute "echo hi" followed by "echo bye"
Some examples of using term
$ term
This will open a new Terminal window at current directory
$ term ~/Documents
This will open a new Terminal window at ~/Documents directory
$ term ~/Documents ~/Pictures ~/Downloads/
This will open new Terminal windows at ~/Documents ~/Pictures ~/Downloads/ directories
$ term -e echo hi
This will open a new Terminal window at current directory and execute "echo hi"
$ term ~/Desktop -e "echo hi && echo bye"
This will open a new Terminal window at ~/Desktop directory and execute "echo hi" followed by "echo hi"
Feel free to suggest any features and send in pull requests :)
The MIT License (MIT)
Copyright (c) Habib Rehman (https://git.io/HR)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished todo so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.