/ft_select

This is the ft_select projet from 42.

Primary LanguageCMIT LicenseMIT

ft_select

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.

Useful links

Credit

I always try to find other implementation on Github. You may find similarities between their code and mine:

Download & Launch

git clone https://github.com/AugustinLopez/ft_select.git
cd ft_select
make

Usage

./ft_select [-chmptCG] [--] [arg1 arg2 ...]

The following command is possible but not advised if an argument contains whitespace characters.

ls `./ft_select *`

Help

./ft_select -h

Options

  • 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

Keys

  • 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.

Test environment

  • Shell: zsh 5.2 (x86_64-apple-darwin16.0)
  • Terminal: xterm_256color
  • Term program Version: 3.2.9