CLIDE(1)

πŸ“¦
version 0.9 Β· 4 versions
, in epel 9

πŸ’… clide β€” the manual, but make it cute

ok so bestie, real talk: this is the manual page for clide(1), a user-contributed Perl thingie that lives in the Perl documentation section (that's the perl manual name, iykyk). It's a color and style highlighting program for text, and honestly it ate. Let me walk you through it ✨


✨ NAME ✨

clide β€” color and style highlighting program for text. that's it, that's the whole vibe πŸŽ€


🌸 SYNOPSIS 🌸

clide [options] [file1] [file2] [...fileN]

| clide [options] (STDIN through pipe)

clide [options] (STDIN. Use Ctrl-D to finish input)

so like, three ways in: files, a pipe, or raw stdin where you hit Ctrl+D when you're done typing 🫢


πŸ’– DESCRIPTION πŸ’–

clide is a program that lets you colorize and add various display-altering attributes to text, based on search patterns and expressions. Currently the focus is on creating ANSI color and style escape codes for use in terminal displays. so it's giving terminal glow-up, no cap ✨


πŸ¦‹ OPTIONS πŸ¦‹

  • -h, --help β€” show some terse help for the program. terse! it's not gonna write you an essay, bestie 😭
  • -e, --expression <expression>,<attributes> β€” the main character option. examples of how you'd use it:
-e /searchpattern/,fg=red,bold
-e HTMLTAG,fg=blue,bg=yellow
  • -d, --definitionfile <file> β€” pull in a definition file (we'll get to the format later, don't worry 🫢)
  • -f, --expressionfile <file> β€” pull in an expression file
  • --highlight, --hl <word1>[,word2,word3,...] β€” quickly highlight the words given in the comma-separated list of words. lowkey the fastest way to slay πŸ’…
  • --highlightattributes, --ha <attribute1>[,attribute2,attribute3,...] β€” the default attributes used by the highlight option. this option uses the same comma-separated values that can be defined in a normal expression.
  • --listcolors β€” show a list of foreground and background colors that can be used 🌈
  • --liststyles β€” show a list of styles that can be used (not all of which may work on your display πŸ™ˆ)
  • --listdefinitions β€” show a list of predefined search expressions
  • --reverseprecedence, -r β€” reverse the precedence order in which expressions are run through. flip it and reverse it πŸ”„
  • --wf, --warmfuzzy "<message>" β€” send the developer a short message to let him know that you like this program. so cute, so wholesome πŸ₯Ή

πŸ”₯ EXAMPLES πŸ”₯

πŸ“ FILE ARGUMENTS

One way to use clide is to process the contents of a file or multiple files. This is done simply by passing the files as arguments after the other options you wish to specify for matching expressions:

clide -e HTMLTAG,fg=yellow index.html

🌊 PIPELINES

Another way to use clide is by piping the output of one program into it. You are sending the standard output (STDOUT) of one program to the standard input (STDIN) of clide. Like this command that sends the output of ls through clide, which colors lines that are directory entries:

ls -l | clide -e /^d.*/,fg=blue,bold

🐚 SHELL ESCAPING

If you are creating more complex search patterns, you are probably going to need to put quotes around the whole argument that is passed to a -e option. This is because your shell will interpret certain characters like (, ), $, &, [, ], etc. For example, this command uses an expression that will change the percentage display of a filesystem to red if it is 94% or more:

df -h | clide -e "/(100|9[4-9])%/,fg=red,bold"

But because ( ) is used in most shells as a subshell sequence, you have to put quotes around the whole expression so that it's not processed by your shell. learn from my mistakes, bestie 😭


🧚 EXPRESSIONS 🧚

Expressions can be specified on the command line using one or more -e options. You can also use the -f option one or more times to specify premade expression files.

⚑ QUICK HIGHLIGHTING

If you're in a hurry and don't want to come up with an expression for matching words or characters that you'd like to highlight, you can use the --highlight option along with a comma-separated list of values you want to match. Like this:

clide --highlight car,truck,boat insurance-readme.txt

By default clide will highlight these words in yellow. You can override this with the --highlightattributes option, specifying what you want in the same way you would pass attribute arguments in a -e argument.

You can use the --highlight option in combination with -e or -f options, but the expressions will be applied after the expressions specified with -e or -f.

πŸͺ„ PERL REGULAR EXPRESSIONS

clide works by passing the expression that you specify into a PERL matching operator. This means that you can pass almost any valid PERL regular expression to clide and it should work as expected. iconic behavior, honestly πŸ‘‘

The only limitation is in what flags you can pass to the search. Currently, you can only pass a i (case insensitive) and/or a g (global search) flag to the search expression. The multiline flag m is not supported. (notes app apology for the m girlies πŸ’€)

For more information about perl regular expressions, see the pcre(1) man page.

The basic way to tell clide what text you want to affect is to use the regular expression search operator. This is passed to the -e option along with a comma-separated list of attributes to set.

clide -e /failed/i,fg=yellow,bg=red,bold

The above expression searches for the word failed (using the i option after the second / means make the search case insensitive). It will change the word failed to have a foreground color of bold yellow (bright) and a background color of red. πŸ’ƒ

πŸ“œ PREDEFINED SEARCH PATTERNS

A list of helpful predefined search patterns is included with clide to make pattern matching easier for the user. A list of the patterns is available by running clide with the --listdefinitions option. You can also put your own definitions in files and use the -f option to include them.

Using a predefined search expression is simply a matter of using its name for the first part of the -e argument, like this:

clide -e HOSTNAME,bold logfile.txt
⚠️ WARNING: Predefined search patterns MUST use all uppercase names. In the future clide may have other expression functions that start with lower case letters and there needs to be a way to differentiate between a pattern definition and an operation. so like, UPPERCASE or it's not happening fr fr

πŸŽ€ FILE FORMATS πŸŽ€

πŸ“Œ NOTE: The author would like to encourage you to put your expression and definition files in a directory called .clide in your home directory. Future versions of clide may make it easier to use these files if you have them located in such a named directory.

πŸ“ EXPRESSION FILE

The expression file is pretty simple, you put each expression one per line in exactly the same way that you would pass it to the -e option. Expression definitions can be used as the expressions themselves are parsed after all the predefined expressions are read in. You can include these files using the -f option.

So an expression file called microblogging might look like this:

HTMLTAG,fg=red,bg=black
URL,fg=yellow,bold,underline
TWITTERGROUP,fg=blue,bold
# Highlight some of my MB account names
/@(mkrenz|climagic|suso)/,fg=yellow,bg=blue,bold
TWITTERMENTION,fg=cyan
IDENTICAGROUP,fg=blue,bold

Then you'd use it like this:

twidge lsrecent | clide -f ~/.clide/microblogging

Comments can be made using a # character at the beginning of the line. (yes bestie, commenting your config is self care 🌸)

πŸ“– DEFINITION FILE

The definition file has a bit more of a format to it. Each line has two columns separated by whitespace. The first column is the name of the definition in all uppercase letters. The second column is the search expression starting with a forward slash and terminated by a forward slash and one or more pcre flags (i or g).

# These are IPs I'm watching out for.
INTERESTINGIPS /\b(3\.14\.159\.26|206\.97\.64\.[29]|10\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})\b/g
# Words I care about.
LOGINWORDS /(error|failed|failure|success|successful)/gi

Then just include the file using -d for each file you want to include.

Note that you don't need to escape or backslash as much in the searches when you put them in a file as compared with when you specify the pattern on the command line. Keep this in mind if you copy and paste your expressions into a file. 🫢


πŸ’€ BUGS AND LIMITATIONS πŸ’€

Because one expression matching will actually alter the line in order to add the escape sequences, matching expressions that are run later may not match what the user expects them to match because the string has changed. This is going to be fixed in a future release. (it's giving "we know, we know" 😭)

Currently clide can only work on 7-bit ASCII text. If it encounters a line with upper 8-bit (binary) characters, it will simply print the line without doing any processing on it. If you're really curious as to why, you can read the comments in the code or ask the author. A future version of clide may not have this limitation.

Most terminal emulators and the console itself have some limitations as to what they can display. Most of them don't support blinking text, only some support dark mode, etc. This is not a limitation of clide, it is your terminal software. don't blame the program, blame the terminal πŸ™ˆ

clide doesn't support multiline matching at this time.


🫢 SEE ALSO 🫢

pcre


πŸ’Œ WARMFUZZY πŸ’Œ

If you like clide, you should let the author know by sending a short message using the --warmfuzzy option, like this:

clide --warmfuzzy "I like clide"

This option makes an HTTP request to a website that will in turn let the author know what you thought.

I included this option because I think that open source projects need an easier way for users to give the developers a little reward for their efforts. genuinely so sweet, protect this energy πŸ₯Ή


This code is copyright 2010 by Mark Krenz under the terms of the GNU GPL version 3. See the file COPYING that comes with clide for more details.


🌈 MORE INFO 🌈

You can find more information about clide at its website at

L<http://suso.suso.org/xulu/clide>

If you'd like to get involved with development in any way, please feel free to contact the author. (devs love a DM, bestie πŸ’Œ)


⭐ AUTHOR ⭐

clide was written by Mark Krenz <mark@suso.com> β€” absolute icon, we stan πŸ‘‘


and that's the whole page! πŸ’– this doc was served up by perl v5.32.1 and dated 2022-01-19 β€” so like, it's vintage but it still slays. mwah, go color something pretty βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from