Skip to content

A C-shell with integrated fuzzy finder, tab completion and more using no external libs

License

Notifications You must be signed in to change notification settings

PhilippRados/PShell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A C-shell with integrated fuzzy finder, tab completion, all standard shell features and more without using curses.

asciicast

Table of contents

Features

Tab completion
shorter_tab.mov
Fuzzy-finder
shorter_fuzzy.mov
Autocompletion
shorter_autocomp.mov
Wildcard-matching
Syntax highlighting

Syntax

Besides the basic && to chain multiple commands, | to pipe one output to another, * and ? for wildcard matching here are some more psh syntax elements:

Input/Output Redirection
> or 1>   stdout redirection
>> or 1>> output append
2>        stderr redirection
2>>       stderr append
<         input redirection
&>        merge stdout, stderr into single file
&>>       append merge stdout, stderr to single file
Fuzzy-finder
<ctrl-f> to open
<ESC>    to close
<Enter>  to choose proposal
Quoted arguments
echo 'this argument counts as single arg' # currently only single quotes supported
echo you\ can\ also\ escape\ whitespace\ with\ backslash

Setup

You only need make and gcc to build. Also your terminal should be capable of displaying unicode characters.

$ git clone https://github.com/PhilippRados/PShell
$ cd PShell
$ make
$ echo /usr/local/bin/psh | sudo tee -a /etc/shells

If you want to install it somewhere else due to permission error in default-path make INSTALLDIR=<custom-path>.
When successfully executed the commands above you can change psh to your default shell like so:

$ chsh -s /usr/local/bin/psh

You can use this same command to change your shell back to your original one just swap out the path.

When first starting the shell you'll be prompted with an option to create a ~/.pshrc file when you don't have one. This will set basic ENV-variables needed to run the shell.

# ~/.pshrc
PATH="some/interesting/path/$" # use $ to append to already extistant env-variable
TERM="linux"                   # without $ any existant env-variable gets overwritten

Testing

  1. Unit_tests: This requires the https://criterion.readthedocs.io/en/master/ testing lib for C. When you have installed that you can run:
    $ make run_tests              # to run all tests
    $ make <file_name without .c> # to run specific tests
  2. Integration_tests:
    $ docker build -t testing_container . # have to setup docker container for tests to run in
    $ make integration_tests              # starts running integration tests in testing_container

Contribution

If you find any bugs or some other kind of issue it would be great if you can open an issue. If you want you can of course also contribute with PRs which should just pass all tests to make sure they don't break anything.

Future Work

  • Implement local session ENV-variables using export and echo $SOME
  • Have builtin command to search through past commands' output
  • Allow for aliasing in ~/.pshrc
  • Allow for inplace variable execution
  • Improve fuzzy-finding algorithm
  • support utf-8 instead of only ascii

About

A C-shell with integrated fuzzy finder, tab completion and more using no external libs

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published