Mirror of https://gitlab.redox-os.org/redox-os/ion

Related tags

System tools ion
Overview

Introduction

Ion is a modern system shell that features a simple, yet powerful, syntax. It is written entirely in Rust, which greatly increases the overall quality and security of the shell. It also offers a level of performance that exceeds that of Dash, when taking advantage of Ion's features. While it is developed alongside, and primarily for, RedoxOS, it is a fully capable on other *nix platforms.

Ion Shell

MIT licensed crates.io Documentation

Ion is still a WIP, and both its syntax and rules are subject to change over time. It is still quite a ways from becoming stabilized, but we are getting very close. Changes to the syntax at this time are likely to be minimal.

Ion Specification

Ion has a RFC process for language proposals. Ion's formal specification is located within the rfcs branch. The RFC process is still in the early stages of development, so much of the current and future implementation ideas have yet to be written into the specification.

Ion Manual

The Ion manual online is generated automatically on each commit via mdBook and hosted on Redox OS's website.

Building the manual for local reference

Sources for the manual are located in the manual directory.

You can build the manual using

make manual
mdbook build -d ../public manual

Ion library example

See the examples folder and the Parallelion project

Packages

Pop!_OS / Ubuntu

The following PPA supports the 18.04 (bionic) and 19.04 (disco) releases. Bionic builds were made using the Pop_OS PPA's rustc 1.39.0 package.

sudo add-apt-repository ppa:mmstick76/ion-shell

Developer set up

Those who are developing software with Rust should install the Rustup toolchain manager. After installing rustup, run rustup override set 1.39.0 to set your Rust toolchain to the version that Ion is targeting at the moment. To build for Redox OS, rustup override set nightly is required to build the Redox dependencies.

Build dependencies

Please ensure that both cargo and rustc 1.39.0 or higher is installed for your system. Release tarballs have not been made yet due to Ion being incomplete in a few remaining areas.

Compile instructions for distribution

git clone https://gitlab.redox-os.org/redox-os/ion/
cd ion
RUSTUP=0 make # By default RUSTUP equals 1, which is for developmental purposes
sudo make install prefix=/usr
sudo make update-shells prefix=/usr

To compile in DEBUG mode, pass DEBUG=1 as an argument to make

Vim/NeoVim Syntax Highlighting Plugin

For vim/nvim users there is an officially-supported syntax highlighting plugin.

Plugin 'vmchale/ion-vim'

Vim Syntax Highlighting

Emacs Syntax Highlighting Plugin

For emacs users there is a kindly-supported syntax highlighting plugin.

(add-to-list 'load-path  (expand-file-name "/path/to/ion-mode"))
(require 'ion-mode)
(autoload 'ion-mode (locate-library "ion-mode") "Ion majore mode" t)
(add-to-list 'auto-mode-alist '("\\.ion\\'" . ion-mode))
(add-to-list 'auto-mode-alist '("/ion/initrc" . ion-mode))

Emacs Syntax Highlighting

Comments
  • WIP: Allow user to prevent commands from being saved in history

    WIP: Allow user to prevent commands from being saved in history

    Commands that should NOT be saved in the history can be defined via the HISTORY_IGNORE environment variable (array). Currently, the following options are supported:

    • "all": No commands will be saved until this option is removed again
    • "whitespace": ignores commands with a leading whitespace character
    • "no_such_command": ignores commands with exit status NO_SUCH_COMMAND
    • "regex:xxx": where xxx is a regex (https://doc.rust-lang.org/regex), ignores all commands that match this regex

    Examples:

    # echo @HISTORY_IGNORE
    
    # let HISTORY_IGNORE = [ all ] # saved
    # let HISTORY_IGNORE = [ whitespace ] # saved
    #  true # ignored
    #  let HISTORY_IGNORE = [  ] # saved
    #  let HISTORY_IGNORE = [ whitespace ] # ignored
    # history
    echo @HISTORY_IGNORE
    let HISTORY_IGNORE = [ all ] # saved
    let HISTORY_IGNORE = [ whitespace ] # saved
     let HISTORY_IGNORE = [  ] # saved
    
    
    # let HISTORY_IGNORE = [ no_such_command ]
    # true # saved
    #  true # saved
    # false # saved
    # trulse # ignored
    
    
    # let HISTORY_IGNORE = [ 'regex:.*' ] # behaves like 'all'
    # true # ignored
    #  true # ignored
    # false # ignored
    # trulse # ignored
    

    Solution: I implemented it in a way that is open for future extensions, unlike bashs implementation ;)

    Drawbacks We need to keep the compiled regexes in a vector, so we have a small heap-usage there. However, currently there is nothing we can do about that.

    TODOs:

    • unit & integration tests

    Fixes: #503 #502 (partly, see https://github.com/redox-os/ion/issues/503#issuecomment-323079748)

    State: WIP

    Other: Also open to discussion if you think I could implement something differently, etc.

    opened by BafDyce 21
  • Job control: libc constants, pid fix

    Job control: libc constants, pid fix

    This PR removes hardcoded signal numbers and adds -1 to the PID when sending SIGCONT. #29

    Tested on FreeBSD, Arch Linux and the Windows Subsystem for Linux. Redox might be even more broken though.

    opened by valpackett 16
  • Moving the glob parser

    Moving the glob parser

    Problem:Globbing during shell expansion (see https://github.com/redox-os/ion/issues/258)

    Solution: I added an extra param to the Normal token which designates it as a normal token that's globable or not. Changes introduced by this pull request:

    • Globbing gets moved and probably (isn't) yet parsed 100% correctly. I'm just submitting this PR so I can get in touch with contributors and notify other people of my attempt at trying to fix this.

    Drawbacks:

    Wildcards during quotes don't parse correctly.

    TODOs: [what is not done yet.]

    Make sure wildcards in quotes get parsed as text (if this happened during the previous version).

    Fixes: [what issues this fixes.] https://github.com/redox-os/ion/issues/258 State: [the state of this PR, e.g. WIP, ready, etc.] Ready for review Blocking/related: [issues or PRs blocking or being related to this issue.]

    Other: The author isn't all that used to programming in Rust.

    opened by mgmoens 12
  • Increase amount of work done without allocation

    Increase amount of work done without allocation

    Problem: [describe the problem you try to solve with this PR.]

    We allocate a lot

    Solution: [describe carefully what you change by this PR.]

    Use SmallVec and SmallString (based on SmallVec) to allow small vectors and strings to be stored on the stack.

    Changes introduced by this pull request:

    Some public API functions that took Strings take SmallStrings now. Also, it's now even faster on my machine.

    • [...]
    • [...]
    • [...]

    Drawbacks: [if any, describe the drawbacks of this pull request.]

    TODOs: [what is not done yet.]

    Clean up the code, unify the methods of creating a singleton smallvec (probably with a macro), move the typedefs to a types module.

    Fixes: [what issues this fixes.]

    State: [the state of this PR, e.g. WIP, ready, etc.]

    WIP

    Blocking/related: [issues or PRs blocking or being related to this issue.]

    Other: [optional: for other relevant information that should be known or cannot be described in the other fields.]


    The above template is not necessary for smaller PRs.

    opened by jFransham 12
  • Ion Variables Patch

    Ion Variables Patch

    Several changes were necessary to allow Ion to use variables for tuning the shell. The History structure, for example, no longer needs to have a max_size variable because this information is already stored as a variable in the shell. This patch adds a few system variables such as CWD, HISTORY_FILE, HISTORY_FILE_ENABLED, HISTORY_SIZE, and DIRECTORY_STACK_SIZE. It also adds the capability for history being logged to a history file, named ion_history. What's currently lacking from this implementation is limiting the size of the history log and not logging commands loaded from files in history.

    opened by mmstick 12
  • Rewrite `pipelines::collect` to be a recursive descent parser

    Rewrite `pipelines::collect` to be a recursive descent parser

    Problem: The previous version of pipelines::collect was a dragon's nest of bitflags and break <label>. It was difficult to extend for features such as #132 and #133.

    Solution: pipelines::collect has been replaced by pipelines::Collector, which encapsulates the logic of pipelines::collect in a recursive descent parser. Additionally, instead of taking a mutable reference to an Option<&str>, pipelines::Collector::run returns a Result<...>.

    Changes introduced by this pull request:

    • Removed pipelines::collect
    • Added pipelines::Collector and replaced instances of pipelines::collect with the logical equivalent for pipelines::Collector.

    Drawbacks:

    • The error messages are still of questionable quality. The main problem is being constrained by peg: the error messages have to be &strs according to the documentation, which is just mind boggling.
    • There's still a good amount of complexity, cyclomatic complexity warning notwithstanding

    TODOs:

    • [x] Add tests for obscure redirects like &>> and ^>>

    State: WIP just so that it has more time for review. Also see TODOs.

    Other: In addition to the mentioned issues I'm trying to figure out what to tackle next. Replacing PEG is a must, but there's also statements.rs which needs a similar makeover.

    opened by hgoldstein 11
  • Add

    Add "exists" builtin

    Problem: Implement the exists builtin mentioned in #409

    Solution: I copied over the test builtin implementation, removed the stuff we don't need in exists and implemented the necessary new logic.

    Changes introduced by this pull request:

    • Added exists builtin
    • Implemented the following flags: -a, -b, -d, -f, --fn, and -s
    • Implemented the STRING check
    • Implemented unit tests for all functions
    • Implemented integration tests

    TODOs:

    • Maybe: binary_is_in_path should use the same logic as the one that is used to spawn new processes
    • test_binary_is_in_path could benefit from some more unit tests, however this requires a more complex/enhanced testing/-directory structure

    Fixes: #409 (partly)

    State: ready

    Blocking/related: #409

    Other:


    The above template is not necessary for smaller PRs.

    opened by BafDyce 10
  • [WIP] Add support for herestrings

    [WIP] Add support for herestrings

    Changes introduced by this pull request:

    • Modified Pipeline::stdin's type to be a union of either a filename or a string input
    • Added support in pipelines::Collector for recognizing herestrings
    • Added required functionality in Shell::execute_pipeline

    TODOs:

    • [ ] Outstanding Bug: running tr '[a-z]' '[A-Z]' <<< "foo" produces no output
    • [x] Add doc comments for the peg::Input enum
    • [x] Add regression tests in pipelines.rs and integration tests in examples/ for herestrings

    Fixes: Closes #133

    State: WIP; see TODOs.

    Other: This PR ended up being slightly different than #200; instead of holding onto the string and writing to stdin once the command had been spawned, this takes a cue from the implementation of &|: write the herestring to a pipe, close the writer end, and pass the reader end to the first command in the pipeline.

    opened by hgoldstein 8
  • Call execve from fork_and_exec in sys/redox.rs so they can share code

    Call execve from fork_and_exec in sys/redox.rs so they can share code

    Problem: execve and fork_and_exec share a large chunk of code

    Solution: Remove the argument building and path resolution in fork_and_exec and call execve instead

    Changes introduced by this pull request:

    • There is no more repeated code between fork_and_exec and execve

    Drawbacks: Ion forks even if the file doesn't exist, whereas before it wouldn't.

    State: Ready

    opened by blackle 7
  • Implement mutiple redirection.

    Implement mutiple redirection.

    Add multiple redirections, that is, support for things like:

    cmd <file1 <file2 ^>> err-log > output | cmd2
    

    In current ion this doesn't work.

    This change at current would be breaking as the statement:

    tr 'x' 'y' | tr 'y' 'z' < file > file2
    

    redirects file to the first tr command. With this change, we would redirect it to the second.

    Overview

    We treat a multiple redirection as it's own job. The only difference between these jobs and normal jobs is that they only read from their source(s) and then write to their sink(s).

    Parsing

    Alter Pipline contain a vector of PipeItems. A PipeItem consists of a Job, a Vec<Redirection> and a Vec<Input>. The above statement would be parsed into two items, cmd together with [file1, file2] as input and [err-log, output] as outputs, and cmd2 with no Inputs or Redirections

    Command Generation and Redirection Setup

    Added two two new variants of RefinedJob, Cat and Tee, Cat for concatenating multiple inputs, Tee for splitting multiple outputs. Alter the generate_commands function to return a Vec<(RefinedJob, JobKind, Vec<Redirection>, Vec<Input>)>, then condense redirect_input and redirect_output into one function that takes ownership and returns a new Vec<(RefinedJob, JobKind)>. It is here that we create the Tee and Cat jobs that we need and put them in the right spot in the pipeline.

    Execution

    Add exec_multi_in and exec_multi_out to handle the multiple redirections. These are fairly straightforward, they just read their sources and write to their sinks. I didn't add any extra paths to exec_job as the new RefinedJob kinds are always part of a pipeline.

    opened by chrisvittal 7
  • Add basename, extension, filename, parent

    Add basename, extension, filename, parent

    Problem: Missing string methods

    Solution: Add some of them

    Changes introduced by this pull request:

    • $basename: Print NAME without leading directories
    • $extension: Print extension of NAME
    • $filename: Print NAME without extension (if there is one)
    • $parent: Print parent of NAME (if there is one)
    opened by pithonsmear 7
Releases(1.0.5)
  • 1.0.5(Jul 15, 2017)

    A number of issues were discovered and resolved, warranting a new release of Ion to represent the current state of development in the alpha. No breaking changes have occurred between releases, but new features have been added. Specifically, this release features the addition of both herestrings and heredocs.

    Ion should now be much more usable now than the previous release. Critical issues around SIGPIPE have been resolved, and many other critical issues have been fixed as well. The issues that remain are relatively minor at the moment, but there is a known bug with globbing that can cause words with ? marks to disappear for non-single-quoted words. The next release will have that issue fixed.

    Static binaries for Linux provided below.

    Source code(tar.gz)
    Source code(zip)
    linux-amd64-musl.tar.xz(482.15 KB)
    linux-i686-musl.tar.xz(493.49 KB)
  • 1.0.4(Jul 9, 2017)

    A huge volume of changes have happened since the last release. For those that are using this release, please report as many issues as you can find, submit feature requests, discuss issues on our GitHub Issues page, and seriously test out all of the signal handling and job control mechanics.

    Changes Since 1.0.3 Alpha

    • Implemented optionally-typed function parameters
    • Implemented implict cd support (works same as in Fish)
    • Implemented Multiple Tuple-like Assignments
    • Fixed tilde expansions in tab completions
    • Implemented expansions in slicing syntax
    • Implemented braced array variables
    • Implemented length methods
    • Implemented arithmetic expansions
    • Converted @[] into @()
    • Implemented @graphemes(), @bytes(), and @chars()
    • Various tab completion fixes
    • Switched to requiring explicit array assignments
    • Implemented background and foreground management
    • Implemented process group support
    • Implemented &| stdout&stderr piping
    • Implemented signal handling
      • SIGINT (Ctrl+C) handling
      • SIGTERM handling
      • SIGHUP handling
      • SIGTSTP (Ctrl + Z) handling
    • Implemented job control
      • disown
      • wait
      • suspend
      • jobs
      • bg
      • fg

    MUSL Linux binaries provided below.

    Source code(tar.gz)
    Source code(zip)
    linux-amd64-musl.tar.xz(470.53 KB)
    linux-i686-musl.tar.xz(482.88 KB)
  • 1.0.3(Jun 17, 2017)

    The following features have been implemented / fixed:

    Ion Improvements

    • Implemented changing keybindings between vi and emacs modes w/ set -o vi and set -o emacs
    • Implemented AND, OR, NOT, XOR, LShift, Rshift, ², and ³ in Calc
    • Backlashes are now retained when quoted so that echo -e and tr work correctly
    • Ctrl + C will now clear the prompt when in liner's readline function, instead of exiting
    • Fixed performing redirections with the echo command
    • Implemented reverse indexing w/ negative values
    • Globbing is now performed at the word parsing stage -> globbing works much better now
    • Filenames are now escaped when they contain some special characters
    • Fixed an issue with aliasing support

    Improvements to Liner Which Affect Ion

    • Supports handling signals now
    • Auto-suggestions work properly when the auto-suggestion is more than one line.
    • The right arrow key now performs auto-completes
    Source code(tar.gz)
    Source code(zip)
    linux-i686-musl.tar.xz(415.87 KB)
    linux-x86_64-musl.tar.xz(407.12 KB)
Owner
Redox OS
A Rust Operating System
Redox OS
Mirror of https://gitlab.com/mmstick/tv-renamer

Build Status: Features Written safely in the Rust programming language Features both a command-line and GTK3 interface Support for Templates to define

Michael Murphy 143 Sep 24, 2022
Everyday-use client-side map-aware Arch Linux mirror ranking tool

Rate Arch Mirrors This is a tool, which fetches mirrors, skips outdated/syncing Arch Linux mirrors, then uses info about submarine cables and internet

Nikita Almakov 196 Jan 2, 2023
Mirror of https://gitlab.redox-os.org/redox-os/redox

Redox is an operating system written in Rust, a language with focus on safety and high performance. Redox, following the microkernel design, aims to b

Redox OS 14.3k Jan 3, 2023
Mirror of https://gitlab.redox-os.org/redox-os/termion

Documentation Examples Changelog Tutorial Termion is a pure Rust, bindless library for low-level handling, manipulating and reading information about

Redox OS 1.9k Dec 31, 2022
Mirror of https://gitlab.redox-os.org/redox-os/rusttype

RustType RustType is a pure Rust alternative to libraries like FreeType. The current capabilities of RustType: Reading OpenType formatted fonts and fo

Redox OS 567 Dec 5, 2022
This project now lives on in a rewrite at https://gitlab.redox-os.org/redox-os/parallel

MIT/Rust Parallel: A Command-line CPU Load Balancer Written in Rust This is an attempt at recreating the functionality of GNU Parallel, a work-stealer

Michael Murphy 1.2k Nov 20, 2022
Mirror of https://gitlab.com/mmstick/tv-renamer

Build Status: Features Written safely in the Rust programming language Features both a command-line and GTK3 interface Support for Templates to define

Michael Murphy 143 Sep 24, 2022
This is a mirror of https://gitlab.com/pcasotti/plate

plate Rust library for writing simpler Vulkan code Installation Add the library to your Cargo.toml file: [dependencies] plate = "0.5" Example Example

Pedro Casotti 15 Sep 10, 2022
Ion - a CLI toolbox for Julia developers

Ion - a CLI toolbox for Julia developers Ion is a CLI toolbox for Julia developer. It provides a set of tools to help you develop Julia packages. Inst

Rogerluo 38 Mar 8, 2023
Provision your authorized_keys via HTTPS/GitHub/GitLab

Keyps Key Provisioning Service Provision authorized_keys from HTTPS/GitHub/GitLab and automatically keep them up to date. Motivation Problem Provision

Samuel Rounce 6 Apr 27, 2023
Federated blogging application, thanks to ActivityPub (now on https://git.joinplu.me/ — this is just a mirror)

Plume Website — Documentation — Contribute — Instances list Plume is a federated blogging engine, based on ActivityPub. It is written in Rust, with th

Plume 1.9k Jan 8, 2023
Rust wrapper for gphoto2 (mirror of https://git.maxicarlos.de/maxicarlos08/gphoto2-rs)

GPhoto2-rs Rust bindings to libgphoto2 What about gphoto-rs? I know about the other crate (gphoto and gphoto2-sys which was created by @dcuddeback, bu

Maxicarlos08 14 Dec 29, 2022
A fast static site generator in a single binary with everything built-in. https://www.getzola.org

zola (né Gutenberg) A fast static site generator in a single binary with everything built-in. Documentation is available on its site or in the docs/co

Zola 10.1k Jan 5, 2023
A fast static site generator in a single binary with everything built-in. https://www.getzola.org

zola (né Gutenberg) A fast static site generator in a single binary with everything built-in. Documentation is available on its site or in the docs/co

Zola 10.1k Jan 10, 2023
A library for extracting #[no_mangle] pub extern "C" functions (https://docs.rust-embedded.org/book/interoperability/rust-with-c.html#no_mangle)

A library for extracting #[no_mangle] pub extern "C" functions In order to expose a function with C binary interface for interoperability with other p

Dmitrii - Demenev 0 Feb 17, 2022
Basic vim-like editor for Redox-OS

red red is an editor based on vim written in Rust. Goal of this project is to provide a basic command-line editor, much like nano. Targeted for Redox.

null 1 Mar 5, 2022
Cassandra DB native client written in Rust language. Find 1.x versions on https://github.com/AlexPikalov/cdrs/tree/v.1.x Looking for an async version? - Check WIP https://github.com/AlexPikalov/cdrs-async

CDRS CDRS is looking for maintainers CDRS is Apache Cassandra driver written in pure Rust. ?? Looking for an async version? async-std https://github.c

Alex Pikalov 338 Jan 1, 2023
A CLI command to parse kustomize build result and notify it to GitLab

ksnotify A CLI command to parse kustomize build result and notify it to GitLab Caution This repository is under development status. What ksnotify does

null 7 Jan 2, 2023
GitLab Deploy is used for deploying software projects to multiple hosts during different phases.

GitLab Deploy is used for deploying software projects to multiple hosts during different phases. This program should be run on Linux.

Magic Len (Ron Li) 1 Nov 22, 2021
Retrieving SSH and GPS keys from GitHub and GitLab

Dormarch Retrieving SSH and GPS keys from GitHub and GitLab Usage After having installed Dormarch, you can see all the options with dormarch -h. To re

Riccardo Padovani 2 Dec 24, 2021