Powerful command interpreter (shell) for linux written in C.
Blazing fast, super simple and indestructible program interpretator (shell) in C language. she#gang
is a feature-rich, customizable shell that aims to provide an enhanced user experience for command-line interactions. Inspired by popular shells like bash, zsh and fish, shegang offers a variety of advanced features to streamline your workflow and boost productivity.
Caution
shegang currently only supports Linux® distributions. Other operating systems such as Windows, MacOS, BSD are not supported.
Note
At the moment, shegang is under active development (alpha), many things may not work, and this version is not recommended for use (all at your own risk).
Current program state: Beta (0.10.30b)
Stable Alpha Release: 0.9.25alpha
You can see commits changelog here or see history of changes here.
You can join to my small russian telegram blog.
shegang comes packed with a wide range of features to enhance your command-line experience:
- Intuitive User Interface: clean and modern interface with a focus on usability and readability.
- Command History: extensive command history tracking with intuitive search and navigation.
- Process Management: shegang uses posix rules to create and manage processes (background and foreground).
- Extensibility: modular design allows for easy addition of new features and plugins.
- Customization: comprehensive configuration opions in
~/.shegangrc
file to personalize the shell's appearance and behavior. And shegang have built-in functionshegang_config
for change configuration for current shell session. - Commands analogues: shegang has its own implementations of some default commands, you can see them in section "Usage".
- Autocomplete: shegang has advanced smart autocomplete that allows you to best experience.
- Syntax Highlight: shegang has advanced syntax highlighting, which allows you to improve your work in shell.
- Fuzzy Searching: fuzzy finding allows you to quickly understand where you made a mistake in the command.
- Aliases: shegang have been functionality for create aliases and use it in shell.
- Colorschemes: shegang have custom color schemes for syntax highlight (you can see in section "usage")
- Plugin system: shegang have plugin manager, plugin loader and example of plugins for shell. Plugins writen in C and compiled to .so files (and load to shegang)
- Environment variables: shegang can set or get value of environment variable with
environment
util. - Delimiters: shegang can split line by delims (&&, &, ||, |, ;)
Me and shegang community is constantly working to improve and expand the shell's capabilities. Some of the planned features include:
- Configuration Management
- Scripting support
- Functions management
- Comprehensive customization
- Productivity-enhancing tools
- Integrated minimalistic text editor like nano or vi
- Pipes (>, >>) for redirect command output
Unfortunately, shegang has bugs that can interfere with the user experience. Below we have placed a list of known bugs that have not been fixed. You can submit bug solution.
There are no known bugs
This project have manual file: man ./shegang_en.man
.
And this project have russian docs / документация на русском and english docs.
You can create translation of docs for another languages.
Shegang use isocline library for read user input, autocomplete and syntax highlight. Library compiled here.
Install make and clang compiler.
sudo apt install make clang readline-devel # Debian/Ubuntu
sudo pacman -S make clang readline # Arch/Manjaro
sudo dnf install make clang readline-devel # Fedora
And run building:
make build install clean
Binary file saved in /usr/local/bin/shegang and you can call shegang
command.
Install make and clang compiler.
sudo apt install make clang readline-devel python3 # Debian/Ubuntu
sudo pacman -S make clang readline python3 # Arch/Manjaro
sudo dnf install make clang readline-devel python3 # Fedora
And run building:
make ctypes
You can view libshegang.so
in ctypes_lib/bin
and view example of usage at the ctypes_lib/shegang.py
.
Install make and clang compiler.
sudo apt install make clang readline-devel python3 # Debian/Ubuntu
sudo pacman -S make clang readline python3 # Arch/Manjaro
sudo dnf install make clang readline-devel python3 # Fedora
And run building:
make example_plugin
You can view example_plugin.so
in root directory.
- Use the arrow keys to navigate through the command history.
- Press the
Tab
key for automatic command and file path completion - Clear the current line by pressing Ctrl+C
- Exit the shell by typing exit or quit
shegang allows you to customize various aspects of the shell by editing the configuraion file located at ~/.shegangrc
. This file supports the following settings:
USERNAME_COLOR
: uppercase color name for username in shell prompt (red, yellow, blue, green, magenta, cyan, black, white, gray).PWD_COLOR
: uppercase color name for current working directory in shell prompt (red, yellow, blue, green, magenta, cyan, black, white, gray)TIME_COLOR
: uppercase color name for current time in shell prompt (red, yellow, blue, green, magenta, cyan, black, white, gray)COLORSCHEME
: lowercase color scheme name (gruvbox, onedark)
If the configuration file is not found or the settings are not present, the shell will use the following default values:
USERNAME_COLOR
:YELLOW
PWD_COLOR
:GREEN
TIME_COLOR
:MAGENTA
COLORSCHEME
:gruvbox
To modify the configuration, simply edit the ~/.shegangrc
file and add or update the desired settings. The changes will take effect the next time you start the shegang
shell or run reload
in shegang.
Or you can use built-in util shegang_config
for configurate variables for current shell session (dont saved to config):
$ shegang_config set <VAR> <VALUE>
# Supported vars:
# USERNAME_COLOR; PWD_COLOR; TIME_COLOR; COLORSCHEME
# Supported values:
# RED, GREEN, BLUE, YELLOW, MAGENTA, GRAY, BLACK, WHITE, CYAN
# for COLORSCHEME: gruvbox, onedark
shegang has the ability to create its own aliases. To do this, create a file ~/.sgaliases and add aliases using the following template:
ls=sgls
In this example we have alias ls
.
Shegang has its own implementations of some default commands, you can see them in the section.
sgls
- is a ls
command analogue, but sgls have colored output and nerd icons.
Note
sgls need nerd icons font for display icons.
-t Show time
-a Show hidden
-l Show as list
-p Show permissions
sglsblk
- is a lsblk
command simple analogue. Just run sglsblk
.
gapf
- is a cat
command simple analogue with info about file. Just run gapf <FILENAME>
.
For load example file, run command: shegang path/to/plugin.so
. If is loaded without errors - use shegang with plugin.
Example plugin:
/**
* Example plugin for Shegang shell
* by alxvdev
*/
#include <stdio.h>
#include <stdlib.h>
// Metadata
typedef struct {
char* name;
char* description;
char* author;
char* license;
} plugin_metadata_t;
// Init - before shell mainloop
int plugin_init(void) {
printf("Example plugin has been initialized\n");
return 1;
}
/**
* @brief Work with user input in shell mainloop
*
* @param input The input
*
* @return status code
*/
int plugin_mainloop(char* input) {
printf("Example plugin: %s\n", input);
return 1;
}
// Deinit - after exit from shell
int plugin_deinit(void) {
printf("Deinitialize example plugin\n");
return 1;
}
// Get plugin metadata;
void get_plugin_metadata(plugin_metadata_t* metadata) {
metadata->name = "Example plugin";
metadata->description = "This is example of plugin for shegang";
metadata->author = "Alexeev Bronislav";
metadata->license = "MIT License";
}
Plugin loading: shegang path/to/plugin.so
.
Compile example plugin: make example_plugin
For get and set value for environment variable use built-in util environment
:
environment set VAR1 TEXT
environment get VAR1 # TEXT
environment get USER # <your username>
Here you can see what shegang can already do and what else is planned to be added in the future:
- Autocompleting
-
ls
command analogue -
lsblk
command analogue -
cat
command analogue - Aliases
- Syntax highlighting
- Fuzzy finding
- Base customization
- Fix bug with grid view in
sgls
- Custom colorschemes for syntax highlight
- Plugin System
- Environment variables
- Shegang Integrated Minimalistic Editor for Linux (SIMEL)
- Improve configuration
- Improve shell prompt customization
You can view full project structure at en docs - project architecture or ru docs - архитектура проекта
colors.c
- module for coloring output (colors.h
) and display PSshegang.c
- main source filetasks_processing.c
- module for work with tasks and processes (tasks_processing.h
)userinput.c
- module for work with user input (userinput.h
)executor.c
- built-in functions for sheadd_background_task (executor.h
)config.c
- module for load config file (config.h
)
If you have questions about using shegang, then create an issue in the repository or write to me at [email protected].
You can also write to me on Telegram: @alexeev_dev
SHEGANG is an Open Source project, and it only survives due to your feedback and support!
Project releases are available at this link.
shegang is released under the MIT License. Feel free to use, modify and distribute the code as per the terms of license.
Copyright © 2024 Alexeev Bronislav. All rights reversed.
The registered trademark Linux® is used pursuant to a sublicense from LMI, the exclusive licensee of Linus Torvalds, owner of the mark on a world-wide basis.