Giter VIP home page Giter VIP logo

ft_select2's Introduction

Ft_select2 42

Codacy Badge Build Status

An implementation of an in-shell file dialog using termcaps [a 42 project].

This project aims to learn the very basics of using termcap library in C programming language. Ft_select2 is an argument viewer in the terminal that returns the user selection on the standard output.

Description

Ft_select2 is the newer version of Ft_select. It displays a list of arguments in the running terminal. Pressing arrow keys on the keyboard will move the cursor through the list of arguments passed to ft_select.

Ft_select2 has 3 different modes:

1. Selection mode (default mode)

2. Command mode by pressing <:> from selection mode

3. Search mode by pressing <\/> from selection mode

Pressing <ESC> in Command or Search mode will put the user back to Selection mode.

Authorized functions:

isatty, ttyname, ttyslot, ioctl, getenv, tcsetattr, tcgetattr, tgetent, tgetflag
tgetnum, tgetstr, tgoto, tputs, open, close, write, malloc, free, read, exit, signal

Selection mode

  • 'Arrow keys' will move the cursor through the circular list. The cursor underlines the file - appears as an underline font.

  • 'space' key will select/un-select one or more choices in the displayed list. A selection positions the cursor on the next element in the list if it exists. A selected file appears overlined.

  • 'return' key validates the selection. It displays the selection to the standard output. Other programs can take the output.

  • 'delete' and 'backspace' keys removes an element from the list.

  • 'ESC' key exists the program.

Command mode

The command mode is used to change the list sort.

  • 'Arrow keys' left or right will change the sort mode.

  • 'ESC' or 'ENTER' key to go back to Selection mode.

Search mode

The search mode helps user to find a file among the many that have been selected.

To find an argument, just type its name and press <ENTER>.

The program will select the found argument of display an error message.

  • 'ESC' to cancel search and go back to Selection mode.

  • 'ENTER' to confirm search and go back to Selection mode.

Requirements

  • Termcap library:
sudo apt-get -y install libncurses-dev

Usage

  • Clone the github repository
git clone --recurse-submodules https://github.com/Ant0wan/Ft_select2.git && cd Ft_select2/ && make -j
  • Build
cd Ft_select2 && make -j
  • Run, format ./ft_select + arguments
./ft_select ARG|...

For instance:

./ft_select Makefile README.md author ft_select ft_select.en.pdf libft src

Demo

demo

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.