All Projects → nickdotht → ft_select

nickdotht / ft_select

Licence: MIT license
A robust file browser and manager in the terminal.

Programming Languages

c
50402 projects - #5 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to ft select

minishell
As beautiful as a shell
Stars: ✭ 124 (+785.71%)
Mutual labels:  unix, school-project
MeetixOS
An hobby OS written in modern C++20 which aims to be Unix-like. Currently based on EvangelionNG, a GhostOS derived kernel
Stars: ✭ 179 (+1178.57%)
Mutual labels:  unix
Advanced-xv6
Modern improvements for MIT's xv6 OS
Stars: ✭ 26 (+85.71%)
Mutual labels:  unix
dotfiles
Command-line lovers unite! I'm sharing my dotfiles, so you don't have to be me and spend years tweaking configuration files for the best developer experience. Enjoy!
Stars: ✭ 38 (+171.43%)
Mutual labels:  unix
go-sysconf
sysconf for Go, without using cgo
Stars: ✭ 119 (+750%)
Mutual labels:  unix
hostname
Cross-platform hostname functions in Rust
Stars: ✭ 48 (+242.86%)
Mutual labels:  unix
pysectools
A small Python library that contains various security things
Stars: ✭ 14 (+0%)
Mutual labels:  unix
webfr
moved to: https://github.com/godzillaframework/godzilla.git
Stars: ✭ 13 (-7.14%)
Mutual labels:  unix
kotoriotoko
KOTORIOTOKO (little bird man) -- Extremely Compatible and Sustainable Twitter Application Written in Shell Script
Stars: ✭ 89 (+535.71%)
Mutual labels:  unix
CDDN-Change-DNS-Dynamically-with-your-Network
This script allows you to have the best configuration of your DNS when switching from one Wi-Fi to another.
Stars: ✭ 22 (+57.14%)
Mutual labels:  unix
pico
This is a very simple HTTP server for Unix, using fork(). It's very easy to use.
Stars: ✭ 83 (+492.86%)
Mutual labels:  unix
PengueeBot
Automation tool, visit our discord channel if you have anything to ask
Stars: ✭ 27 (+92.86%)
Mutual labels:  unix
dotfiles
My collection of dotfiles
Stars: ✭ 77 (+450%)
Mutual labels:  unix
CinderOS
👨‍💻An operating system, built from scratch in C.
Stars: ✭ 26 (+85.71%)
Mutual labels:  c-programming
yaf
Yet another system fetch that is minimal and customizable
Stars: ✭ 23 (+64.29%)
Mutual labels:  unix
newrelic-unix-monitor
Monitoring service for Unix (AIX, Linux, HP-UX, MacOS, Solaris) systems
Stars: ✭ 26 (+85.71%)
Mutual labels:  unix
C-Programming
C Programming Experiments
Stars: ✭ 25 (+78.57%)
Mutual labels:  c-programming
TermGL
2D & 3D graphics engine in the terminal [C/C++]
Stars: ✭ 219 (+1464.29%)
Mutual labels:  unix
dotfiles
My personal configuration and bootstrap files
Stars: ✭ 14 (+0%)
Mutual labels:  unix
recurrent-neural-net
A recurrent (LSTM) neural network in C
Stars: ✭ 68 (+385.71%)
Mutual labels:  c-programming

FT_SELECT - @42Born2Code

A robust file browser and manager in the terminal.

About

ft_select is the third project of the Unix branch at 42. The goal for this project is to learn more about screen oriented programs using termcap/terminfo libraries in the C programming language. It's originally just an argument viewer in the terminal but I decided to take it one step further and gave it browsing capabilities on the file system.

The main goal, however, is to build my own functional shell. Something like zsh and bash, this is what the next project at my school is about and ft_select is just a small part of it.

How to use it

Requirements

To be able to build and run this program, you'll need:

  • A Unix system
  • GNU make (v3.81)
  • GCC (v4.2.1)

Those are the versions used during development.

If you're on Linux, make sure you install

  • The termcap library:

      sudo apt-get install libncurses5-dev
    

Building

  1. Download/Clone this repo

     git clone https://github.com/r4meau/ft_select
    
  2. cd into the root directory and run make

     cd ft_select
     make
    

Running

A basic usage would involve at least one argument:

./ft_select hello

Features

  • If you pass a list of arguments to the program it gets displayed in your terminal.
  • You can move through the list using arrows.
  • One or more choices can be selected or un-selected with the space key. With each selection, the cursor will automatically position itself on the next element.
  • You can validate the selection with the return key, the list of choices will be sent back to the shell. This allows other programs to use the output of the program as their input. i.e: rm ./ft_select file1 file2 file3
  • Re-organizes the display on window resize or displays a blank screen if the list cannot fit the in window.
  • Exits on ESC key
  • Pressing the delete or backspace keys removes an element from the list. In Real mode (Read below), it will automatically delete the active element from the system if it's a valid file/folder. So watch out!
  • Press * to select all and - to unselect all.
  • Colored output based on some supported file extensions.
  • Pressing the keys O and B opens a valid folder and goes back to the parent root directory respectively.
  • Handles interruption signals gracefully (ctrl + z, ctrl + c, kill, etc...)
  • Restores the screen to what it was before clearing it.
  • No memory leaks
  • Whole codebase is commented for easier browsing.

Real mode

You can launch the program in real mode. In real mode, when you press delete/backspace on a valid file or folder, it will be deleted on the system too. So again, watch out! I'm not responsible for any loss of your files.

To run ft_select in real mode, use the flag -r or --real

./ft_select -r I love 42

TODO

  • Add breadcrumb
  • Press H to see hidden/dot files
  • Add copy and move capabilities
  • Even better error handling

NOTES

  • Don't mind the uneven tab widths, just set your editor's tab size to 4 (hard tabs, not soft) and it should be fine
  • You might not like the fact that I'm not adding curly braces for some if statements, curly braces add extra lines, and my school has a coding standard (The Norme) that you must follow to succeed the projects, this standard imposes some rules like 25 lines function limits etc... Read more about it here.
  • I added a second branch called original which is the original code of the program before I started norming the code. It will lack some extra features that I didn't add back then. It's here to show me how I code initially and will help me see how much I improve over time.

Resources

Here's a list of resources (in no particular order) I found useful to complete this project:

Acknowledgment

Thanks to my peers at 42, Christophe Gerbaudo (@cgerbaud) and Giacomo Guiulfo (@gguiulfo) who helped me go faster on this project by giving me some great tips.

Sponsors

Sponsor

Enjoy!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].