Skip to content

archpulse/Vosh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vosh

vosh (Very Optimized Shell) is a fast, minimal, and smart POSIX-compatible shell written in C with advanced features for both beginners and power users.

Features

Core Functionality

  • Fast execution - Lightweight C implementation with minimal overhead
  • POSIX compatibility - Standard shell syntax and command execution
  • Pipeline support - Full support for pipes and command chaining
  • Job control - Background jobs, fg/bg commands, and job management
  • Smart timing - Automatic execution time display for slow commands
  • History management - Persistent command history with deduplication options

User Experience

  • Beginner mode - Friendly command hints and explanations in English/Russian
  • Custom prompts - Highly configurable prompt with Git integration
  • Right prompt - Optional right-side prompt with contextual information
  • Auto-cd - Navigate to directories without typing cd
  • Smart aliases - Define custom command shortcuts
  • Functions - Shell scripting with custom functions in .voshrc

Prompt Features

  • Git branch display with dirty status detection
  • Background jobs counter
  • Current time display
  • Username display
  • Path truncation and customization
  • Execution time for commands
  • Customizable colors and symbols

Installation

Prerequisites

  • GCC compiler
  • GNU Readline library
  • ncurses library

On Debian/Ubuntu:

sudo apt-get install gcc libreadline-dev libncurses-dev

On Fedora/RHEL:

sudo dnf install gcc readline-devel ncurses-devel

Build from Source

make

This will create the vosh executable in the current directory.

Install

sudo cp vosh /usr/local/bin/

Usage

Starting vosh

vosh                # Start with default settings
vosh --beginner     # Start in beginner mode (with hints)
vosh --pro          # Start in pro mode (minimal output)
vosh --help         # Show help message

Built-in Commands

Command Description
cd [dir] Change directory (supports - for previous, no args for $HOME)
.. Go up one directory
... Go up two directories
export VAR=value Set environment variables
reload Reload ~/.voshrc configuration
help Show help message
exit Exit vosh
jobs List background jobs
fg [%n] Bring job to foreground
bg [%n] Resume job in background
kill [-SIG] %n|pid Send signal to job or process
config Show current configuration

Beginner Mode Features

explain ls          # Get explanation of 'ls' command
friendly help       # Show English/Russian command aliases

Configuration

vosh reads configuration from ~/.voshrc on startup.

Example Configuration

# Timing settings
set timer_threshold=0.05
set show_exec_time=threshold

# Prompt settings
set prompt_symbol=❖
set minimal_mode=false
set show_git_branch=true
set show_jobs_count=true
set show_username=false
set show_time=false
set path_max_len=0
set path_show_full=false

# Colors
set color_success=magenta
set color_error=red
set color_path=gray
set color_git=cyan
set color_jobs=yellow
set color_time=gray
set color_user=gray
set color_exec_time=yellow

# History
set history_size=5000
set history_dedup=sequential

# Behavior
set auto_cd=false
set bell=false
set beginner_mode=false

# Right prompt
set rprompt=true
set rprompt_segments=git,node,time

# Aliases
alias ll="ls -lah"
alias gs="git status"
alias gp="git pull"

# Custom functions
func hello {
  echo "Hello, $1!"
  echo "Args count: $#"
}

# Environment variables
export MY_VAR="test value"

Configuration Options

Timing

  • timer_threshold - Minimum execution time (seconds) to display (default: 0.05)
  • show_exec_time - When to show execution time: always, never, threshold (default: threshold)

Prompt

  • prompt_symbol - Symbol shown in prompt (default: ❖)
  • prompt_format - Custom prompt format string (empty = built-in)
  • minimal_mode - Simplified prompt (default: false)
  • show_git_branch - Display Git branch in prompt (default: false)
  • show_jobs_count - Display background jobs count (default: true)
  • show_username - Display username in prompt (default: false)
  • show_time - Display current time in prompt (default: false)
  • path_max_len - Maximum path length (0 = unlimited)
  • path_show_full - Show full path instead of truncated (default: false)

Colors

Available colors: green, red, blue, cyan, yellow, magenta, gray, white, black

  • color_success - Color for successful command prompt
  • color_error - Color for failed command prompt
  • color_path - Color for current path
  • color_git - Color for Git branch
  • color_jobs - Color for jobs counter
  • color_time - Color for time display
  • color_user - Color for username
  • color_exec_time - Color for execution time

History

  • history_size - Maximum history entries (-1 = unlimited, default: 5000)
  • history_dedup - Deduplication mode: off, sequential, global (default: sequential)

Behavior

  • auto_cd - Navigate to directories without cd command (default: false)
  • bell - Enable terminal bell (default: false)
  • beginner_mode - Enable beginner-friendly hints (default: false)

Right Prompt

  • rprompt - Enable right-side prompt (default: true)
  • rprompt_segments - Comma-separated segments: git, node, python, time, jobs (default: git,node,time)

Custom Functions

Define reusable shell functions in .voshrc:

func greet {
  echo "Hello, $1!"
  echo "You passed $# arguments"
}

func mkcd {
  mkdir -p "$1"
  cd "$1"
}

Call them like regular commands:

greet World
mkcd new-project

Plugins

Place plugin files in ~/.config/vosh/plugins/ with .plugin extension. Plugins use the same syntax as .voshrc.

Example plugin (~/.config/vosh/plugins/git.plugin):

alias gst="git status"
alias gco="git checkout"
alias gcm="git commit -m"
alias glog="git log --oneline --graph"

func gac {
  git add .
  git commit -m "$1"
}

Advanced Features

Pipeline Execution

ls -la | grep vosh | wc -l
cat file.txt | sort | uniq > output.txt

Background Jobs

sleep 100 &          # Run in background
jobs                 # List jobs
fg %1                # Bring job 1 to foreground
bg %1                # Resume job 1 in background
kill -9 %1           # Kill job 1

Job Control Signals

kill -TERM %1        # Terminate gracefully
kill -KILL %1        # Force kill
kill -STOP %1        # Pause job
kill -CONT %1        # Resume job

Prompt Format Variables

When using custom prompt_format, these variables are available:

  • {user} - Current username
  • {host} - Hostname
  • {path} - Current directory path
  • {git} - Git branch (if in repo)
  • {jobs} - Background jobs count
  • {time} - Current time
  • {status} - Last command exit status

Development

Project Structure

.
├── src/              # Source files
│   ├── main.c        # Main entry point
│   ├── builtin.c     # Built-in commands
│   ├── config.c      # Configuration parser
│   ├── exec.c        # Command execution
│   ├── friendly.c    # Beginner mode features
│   ├── jobs.c        # Job control
│   ├── parser.c      # Command parsing
│   ├── prompt.c      # Prompt generation
│   └── timer.c       # Execution timing
├── include/          # Header files
├── obj/              # Object files (generated)
├── Makefile          # Build configuration
└── README.md         # This file

Building

make                 # Build vosh
make clean           # Remove build artifacts

Compiler Flags

  • -Wall -Wextra - Enable all warnings
  • -O2 - Optimization level 2
  • -lreadline -lncurses - Link required libraries

Troubleshooting

Command not found

Make sure vosh is in your PATH:

export PATH=$PATH:/usr/local/bin

History not saving

Check that ~/.vosh_history is writable:

touch ~/.vosh_history
chmod 644 ~/.vosh_history

Git branch not showing

Ensure you're in a Git repository and show_git_branch=true in .voshrc.

Readline issues

If you experience input problems, try rebuilding with:

make clean && make

License

This project is open source. Feel free to use, modify, and distribute.

Contributing

Contributions are welcome! Please ensure code follows the existing style and passes compilation without warnings.

Version

Current version: 0.1.0

Author

vosh - A minimal, fast, and smart shell for modern developers.

About

vosh is a fast, minimal, and smart POSIX-compatible shell written in C with advanced features for both beginners and power users.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors