A command-line tool to scroll multi-line text and ASCII art across your terminal.
- Multi-line Support: Scrolls entire blocks of text, like ASCII art, while preserving the layout.
- ANSI Color Parsing: Correctly interprets and displays embedded ANSI color codes from the input.
- Customizable Animation: Control the scroll direction, speed, and number of repetitions.
- Flexible Input: Accepts text from command-line arguments or piped from stdin.
- Advanced Options: Includes long options (e.g.,
--count), flexible argument order, and ansl-inspired "accident" mode that ignores interrupts.
Follow these steps to clone and compile the project.
1. Clone the repository
git clone https://github.com/agtkh/marquee.git
cd marquee2. Install Dependencies
You will need a C compiler (gcc or clang), make, and the ncurses development library.
-
On Debian / Ubuntu:
sudo apt update sudo apt install build-essential libncurses-dev
-
On Red Hat / CentOS / Rocky Linux:
sudo yum groupinstall "Development Tools" sudo yum install ncurses-devel -
On macOS (using Homebrew):
# Install Command Line Tools if you haven't already xcode-select --install # Install ncurses via Homebrew brew install ncurses
3. Compile
Simply run make in the project directory.
makeThe executable marquee will be created in the current directory.
4. Install
To install the marquee executable to /usr/local/bin, run:
sudo make install5. Uninstall
To remove the marquee executable from /usr/local/bin, run:
sudo make uninstallThe program's help message provides a complete list of options.
$ ./marquee --help
Usage: ./marquee [text...] [OPTIONS]
Displays multi-line text as a scrolling marquee in the terminal.
Text can be provided as arguments (use $'...' for newlines), or piped via stdin.
OPTIONS:
-c, --count <n> Scroll <n> times. (Default: 1)
-s, --speed <usec> Set animation delay in microseconds. (Default: 100000)
-r, --reverse Scroll from left to right.
-l, --loop Scroll infinitely.
-a, --accident Ignore Ctrl-C interruptions.
-h, --help Display this help message and exit.
Here are more examples demonstrating the different ways you can use marquee.
The most basic usage: scrolling text once from right to left (default behavior).
Command:
./marquee "Hello, terminal!"Expected Behavior: The phrase "Hello, terminal!" will scroll across your terminal from the right edge to the left and then the program will exit.
Use the --loop option (-l) to make the text scroll continuously, and --speed (-s) to control the delay between steps (in microseconds).
Command:
./marquee --loop --speed 150000 "Scrolling slowly and continuously..."Expected Behavior: The text will scroll from right to left repeatedly at a slightly slower pace. You'll need to press q to exit.
The --reverse option (-r) changes the scrolling direction.
Command:
./marquee --loop --reverse "Moving from left to right"Expected Behavior: The text will scroll from the left edge of your terminal to the right repeatedly. Press q to stop.
The --count option (-c) specifies how many times the text should scroll across the screen.
Command:
./marquee --count 2 "Scroll twice"Expected Behavior: The phrase "Scroll twice" will scroll from right to left two times, and then the program will automatically exit.
You can use the $'' syntax in your shell to provide multi-line text as a command-line argument.
Command:
./marquee $'First Line\n Second Line\nThird Line' --loopExpected Behavior: The three lines of text will scroll together as a block from right to left continuously. Press q to exit.
If your terminal supports ANSI escape codes for colors, marquee will interpret them.
Command:
echo -e "\x1b[31mRed Text\x1b[0m and \x1b[32mGreen Text\x1b[0m" | ./marquee --loopExpected Behavior: The text will scroll with "Red Text" displayed in red and "Green Text" in green. Press q to stop.
Combine multi-line input (often from tools like figlet) with speed control.
Command:
figlet -f banner "MARQUEE" | ./marquee --loop --speed 180000Expected Behavior: The large ASCII art banner for "MARQUEE" will scroll from right to left repeatedly at a slower speed. Press q to exit.
The --accident option (-a) makes the program ignore Ctrl+C interrupts for the duration of one scroll. This is a playful nod to the sl command.
Command:
./marquee --accident "Try to stop me with Ctrl-C!"Expected Behavior: The text will scroll once from right to left. During the scroll, pressing Ctrl+C will have no effect. The program will exit automatically after the scroll is complete.
This project is licensed under the MIT License. See the LICENSE file for details.
