All Projects → adam-mcdaniel → dune

adam-mcdaniel / dune

Licence: Apache-2.0 License
A shell🐚 by the beach🏖️!

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to dune

laravel-web-console
💻 Web console for your Laravel application
Stars: ✭ 142 (-76.72%)
Mutual labels:  console
circumflex
🌿 It's Hacker News in your terminal
Stars: ✭ 43 (-92.95%)
Mutual labels:  console
cmdr
POSIX-compliant command-line UI (CLI) parser and Hierarchical-configuration operations
Stars: ✭ 94 (-84.59%)
Mutual labels:  console
contour
Modern C++ Terminal Emulator
Stars: ✭ 761 (+24.75%)
Mutual labels:  console
preact-component-console
A console emulator for preact.
Stars: ✭ 29 (-95.25%)
Mutual labels:  console
ctable
C library to print nicely formatted tables
Stars: ✭ 13 (-97.87%)
Mutual labels:  console
jira-cli
🔥 [WIP] Feature-rich interactive Jira command line.
Stars: ✭ 809 (+32.62%)
Mutual labels:  console
screeps-commander
用于游戏《Screeps》的移动端控制台 WEB 应用
Stars: ✭ 18 (-97.05%)
Mutual labels:  console
console.img
🎉 Display a picture in the Chrome browser console
Stars: ✭ 44 (-92.79%)
Mutual labels:  console
yii-console
Yii console components
Stars: ✭ 48 (-92.13%)
Mutual labels:  console
RecoverPy
🙈 Interactively find and recover deleted or 👉 overwritten 👈 files from your terminal
Stars: ✭ 189 (-69.02%)
Mutual labels:  console
pyeez
easy elegant representation on console
Stars: ✭ 14 (-97.7%)
Mutual labels:  console
command-line
⌨ Command line options and arguments parser.
Stars: ✭ 35 (-94.26%)
Mutual labels:  console
croatoan
Common Lisp bindings for the ncurses terminal library.
Stars: ✭ 111 (-81.8%)
Mutual labels:  console
ishell
Create shell environments with Python
Stars: ✭ 70 (-88.52%)
Mutual labels:  console
pretty-routes
Display your Laravel routes in the console, but make it pretty. 😎
Stars: ✭ 627 (+2.79%)
Mutual labels:  console
slim-command
Useful commands for slim application
Stars: ✭ 13 (-97.87%)
Mutual labels:  console
nchat
Terminal-based Telegram client for Linux and macOS
Stars: ✭ 68 (-88.85%)
Mutual labels:  console
fdlinecombine
Read multiple fds and print data to stdout linewise.
Stars: ✭ 40 (-93.44%)
Mutual labels:  console
ascii chart
Nice-looking lightweight console ASCII line charts ╭┈╯. Port of kroitor/asciichart.
Stars: ✭ 24 (-96.07%)
Mutual labels:  console

dune

A shell by the beach!

NOTE: Click the image above for a video demonstration.

About the Author

I'm a bored sophomore in college working on projects to fill the time. If you enjoy my work, consider supporting me by buying me a coffee!

Buy Me A Coffee

Why write another shell?

I feel that bash is great in a lot of ways, but it doesn't exactly feel cozy: it's lacking a sort of personal touch, and it's also missing quick and easy customizability. With my last shell, Atom, I had accomplished some of the coziness that bash was missing, but I also introduced a lot of really fatal flaws in the syntax and the type system.

Dune, however, is designed completely differently from Atom (although you might notice the similarities in their widget systems). The interpreter itself is standalone, and it holds almost none of the functionality you see in the default distribution of Dune. If you wanted to, you could write a custom frontend and make a unique Dune based shell of your own!

This frontend implementation turns the coziness dial to 11. Just check out the shell's default startup script!

I put a lot of work into making Dune just fun to use. It's like a neat little operating system itself!

Dune also attempts to be a usable scripting language, and even offers a few niche metaprogramming features such as quoting (borrowed from Lisp), operator overloading, and macros!

Overall, I wrote Dune to have a complete shell of my own: one that's fast, useful, and pretty.

(Also, writing a shell is just kinda really fun)

Usage

Dune has a bunch of customizable components. Here's how you can change them and make your shell your own!

The Prelude

Before entering interactive mode, Dune executes the prelude. The prelude is just the startup file .dune-prelude stored in the home directory for your user. If you don't provide your own prelude file, Dune will execute its own default prelude with an introduction to the shell.

You can see my example personal prelude here.

The REPL

Dune's REPL is entirely customizable by overloading the following functions:

Name Purpose Default Implementation
prompt This function is called to generate the text which prompts the user for input. It takes the current working directory, and returns a string.
let prompt = cwd -> fmt@bold ((fmt@dark@blue "(dune) ") +
(fmt@bold (fmt@dark@green cwd)) +
(fmt@bold (fmt@dark@blue "$ ")))
incomplete_prompt This function is called to generate the text which prompts the user for input when they have entered an incomplete expression. It takes the current working directory, and returns a string.
let incomplete_prompt = cwd -> ((len cwd) +
(len "(dune) ")) * " " +
(fmt@bold (fmt@dark@yellow "> "));
report This function is called to print a value to the console after evaluation. The default implementation is a builtin function (implemented in Rust), but you can overload it with any callable value nonetheless.

I highly recommend using the fmt module when implementing your own customizations for your prompt!

Aliases

This distribution of Dune uses the Symbol type (the type of variable names and paths) to implement calling programs. Whenever an expression of type Symbol is evaluated as a command in interactive mode, it is invoked as a program.

Because of this, you can define aliases by assigning a variable to a program's name like so!

If you have defined a variable that overshadows your program's name (such as an alias), you can quote the program name to run it.

Overshadowed

Macros

To write functions that modify your shell's environment and act like commands or programs themselves, use a macro!

Macros

Macros, when called with zero arguments, are passed the current working directory. When invoked, they assume the environment of the callee: if you execute a macro, it will execute as if you executed the contents of the macro itself with the parameter defined as the argument passed.

Piping and Redirection

Piping and redirection are done with the | and >> operators. Here's some example uses!

Piping and Redirection

If a value is piped into a callable object, like a function or macro, it is performed as an application; otherwise, the expression is treated like a regular call to a program.

Standard Library

Dune offers an extensive standard library, and also provides a pretty interface to see all the functions available in each module!

Dune offers the following builtin libraries:

Name Description
rand A library for randomness
time A library with date and time functions
math A module for math and trig functionality
fs A module for interacting with the file system
fn A functional programming library
fmt A library for text formatting on the console (color, styling, hyperlinks, text wrapping, etc.)
os A small module with the host's OS info
widget A module for creating text widgets
shell A small module for information about the Dune shell
console A library for manipulating the console

For more information about each, just run echo library-name.

Installation

To install, you must download Rust from here. If you already have Rust installed you will probably need to update. Dune uses a lot of recently stabilized features.

Development Build

# Install directly from git with cargo
cargo install --git https://github.com/adam-mcdaniel/dune

# Or, alternatively, the repo and install from source
git clone https://github.com/adam-mcdaniel/dune
cd dune
cargo install -f --path .

Releases

To get the current release build, install from crates.io.

# Also works for updating dune
cargo install -f dune

Currently, since Dune is in its early stages of development, I would recommend against using releases at the moment. There are a lot of bug fixes and new features added inbetween releases.

After Install

# Just run the dune executable!
dunesh
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].