The ft_select program is an optional exercice from the Unix branch (42 curriculum). The goal is to allow an user to easily move around a printed list of argument with the arrow keys. The terminal display is manipulated with the termcap library. The original terminal settings is reset to its default value when the program is over.
I always try to find other implementation on Github. You may find similarities between their code and mine:
git clone https://github.com/AugustinLopez/ft_select.git
cd ft_select
make
./ft_select [-chmptCG] [--] [arg1 arg2 ...]
The following command is possible but not advised if an argument contains whitespace characters.
ls `./ft_select *`
./ft_select -h
- h: Help
- G: Color On
- p: Prettier Display On
- c: Column + cursor at bottom On (For huge list of argument)
- m: Non-Circular Movement On
- C: Terminal Cursor Hide
- t: Use /dev/tty instead of default STDIN_FILENO
- Arrow keys: move around the list. The default movement is circular: one arrow can move through the whole list.
- Space key: Select/Deselect an argument.
- Enter key: End the program and print each selected argument separated by one space without carriage return.
- Escape key: End the program immediately.
- Backspace/Delete keys: Remove the cursor argument. If no argument left, end the program immediately.
- F2 key: Select/deselect all
- F3 key: Color On/Off
- F4 key: Prettier display On/Off
- F5 key: Column + cursor at bottom On/Off
- F6 key: Non-Circular Movement On/Off
- F7 key: Terminal Cursor Show/Hide
- Page Up/Page Down key: Change the order in which the argument will be printed.
- Keys such as 'a', 'b', 'c' can be used to look for an argument starting with the corresponding letter. Case sensitive.
- Shell: zsh 5.2 (x86_64-apple-darwin16.0)
- Terminal: xterm_256color
- Term program Version: 3.2.9