Install Pet Command Line Interface Code Manager

We can't remember all the commands, right? Yes. In addition to the frequently used commands, it is almost impossible to remember some long commands that are rarely used. This is why some external tools are needed to help us find commands when we need them. Now let's get to know "Pet," which is a simple command-line code manager written in the Go language.

With Pet, you can:

Register/add your important, lengthy and complex command snippets.

Search interactively for saved command segments.

Run the code snippet directly without typing it over and over again.

Easily edit saved code snippets.

Synchronize clips with Gist.

Use variables in the fragment

There are many more features coming soon.

Install the Pet Command Line Interface Code Manager

Since it is written in the Go language, make sure that you already have Go installed on your system.

After installing Go, get the latest binary from the Pet publishing page.

Wget https://github.com/knqyf263/pet/releases/download/v0.2.4/pet_0.2.4_linux_amd64.zip

For 32-bit computers:

Wget https://github.com/knqyf263/pet/releases/download/v0.2.4/pet_0.2.4_linux_386.zip

Extract the downloaded file:

Unzip pet_0.2.4_linux_amd64.zip

For 32-bit:

Unzip pet_0.2.4_linux_386.zip

Copy the pet binaries to PATH (like /usr/local/bin).

Sudo cp pet /usr/local/bin/

Finally, let it execute:

Sudo chmod +x /usr/local/bin/pet

If you are using an Arch-based system, you can use any AUR helper tool to install it from AUR.

Use Pacaur:

Pacaur -Spet-git

Use Packer:

Packer -Spet-git

Use Yaourt:

Yaourt -Spet-git

Use Yay:

Yay -Spet-git

In addition, you need to install fzf or peco tools to enable interactive search. See the official GitHub link for how to install these tools.

usage

Run pet without any parameters to see a list of available commands and general options.

$pet

Pet - Simple command-line snippet manager.

Usage:

Pet[command]

Available Commands:

Configure Edit config file

Edit Edit snippet file

Exec Run the selected commands

Help Help about any command

List Show all snippets

newCreateanewsnippet

Search Search snippets

Sync Sync snippets

Version Print the version number

Flags:

--config stringconfig file(defaultis$HOME/.config/pet/config.toml)

--debug debug mode

-h, --help help forpet

Use"pet [command] --help"formore information aboutacommand.

To see the help section for a specific command, run:

$pet[command] --help

Configure Pet

The default configuration actually works well. However, you can change the default directory for saving clips, select the selector (fzf or peco) to use, edit the clip's default text editor, add GIST id details, and more.

To configure Pet, run:

$pet configure

This command will open the default configuration in the default text editor (for example, I'm vim) and change or edit specific values ​​according to your requirements.

[General]

Snippetfile = "/home/sk/.config/pet/snippet.toml"

Editor = "vim"

Column = 40

Selectcmd = "fzf"

[Gist]

File_name = "pet-snippet.toml"

Access_token = ""

Gist_id = ""

Public = false

~

Create clips

To create a new fragment, run:

$pet new

Add a command and description and press Enter to save it.

Command> echo'Hell1o, Welcome1 2to OSTechNix4' | tr -d'1-9'

Description> Remove numbers from output.

This is a simple command that removes all numbers from the echo command output. You can remember it easily. However, if you rarely use it, you may forget it completely in a few days. Of course, we can use CTRL+R to search for history, but Pet will be easier. In addition, Pet can help you add any number of items.

Another cool feature is that we can easily add previous commands. To do this, add the following line in your .bashrc or .zshrc file.

Functionprev(){

PREV=$(fc -lrn | head -n1)

Sh -c"pet new `printf %q "$PREV"`"

}

Execute the following command to validate the saved changes.

Source.bashrc

or:

Source.zshrc

Now run any command, for example:

$cat Documents/ostechnix.txt | tr'|''' | sort | tr'''|' | sed"s/.$/\/g"

To add the above command, you do not have to use the pet new command. only need to:

$prev

Add a description to the command code snippet and press Enter to save it.

Fragment list

To view saved clips, run:

$pet list

Editing clips

If you want to edit the description or command of the code snippet, run:

$pet edit

This will open all saved code snippets in your default text editor. You can edit or change snippets as needed.

[[snippets]]

Description = "Remove numbers from output."

Command = "echo 'Hell1o, Welcome1 2to OSTechNix4' | tr -d '1-9'"

Output = ""

[[snippets]]

Description = "Alphabetically sort one line of text"

Command = " prev"

Output = ""

Use tags in clips

To use labels for judgment, use the following -t flag.

$pet new -t

Command> echo'Hell1o, Welcome1 2to OSTechNix4' | tr -d'1-9

Description> Remove numbers from output.

Tag> tr command examples

Execution fragment

To execute a saved fragment, run:

$pet exec

Select the code segment you want to run from the list and press Enter to run it:

Remember that you need to install fzf or peco to use this feature.

Finding clips

If you have a lot of clips to save, you can easily search for them using strings or keywords like below.qjz.

$pet search

Enter search terms or keywords to narrow the search results.

Synchronize clips

First of all, you need to get an access token. Go to this link https://github.com/settings/tokens/new and create an access token (only the "gist" scope is required).

Use the following command to configure Pet:

$pet configure

Set the token to the access_token in the [Gist] field.

After the setup is complete, you can upload the clip to Gist as below.

$pet sync -u

Gist ID: 2dfeeeg5f17e1170bf0c5612fb31a869

Upload success

You can also download clips on other PCs. To do this, edit the configuration file and set gist_id to GIST id in [Gist].

Afterwards, download the clip using the following command:

$pet sync

Download success

For more details, see Help Options:

Pet -h

or:

Pet[command] -h

This is all. Hope this helps you. As you can see, Pet is fairly easy to use! If you have a hard time remembering long commands, the Pet utility will certainly be useful.

LED DJ Booth Display

Portable DJ Booth Display is the irregular display with seamless splicing, which can actualize music and video synchronously. Video DJ Booth Display realizes high brightness, large viewing angle, high resolution and high contrast ratio.

Priva LED DJ Booth Screens are biased towards users with special needs. Currently, they are mainly used in entertainment venues, outdoor media, exhibition halls and other environments.

Characteristics

1. Light weight , high heat dissipation, low power consumption

2. Compatible multi-source input such as DVD ,DVI, VGI

3. Type of weather conditions:snow & wind loading , humidity, lightning protection


LED DJ Booth Display, Portable DJ Booth, VAV LED DJ Booth Display, Diamond DJ Booth Display

Shenzhen Priva Tech Co., Ltd. , https://www.privaled.com