Coder Social home page Coder Social logo

civa's Introduction

Civa

Build Status codecov

A own implementation of a shell

Goals

  • Learn UNIX more
  • Learn rust more, try not to rely on shell impls in rust, but learn it the hard way
    • Don't use clone (only if reasoned well)
    • Use generics if useful
    • Use lifetimes if useful
  • As long as I don't know how dirty code and programs look, I can not build clean code and programs
  • Build something I would use, with the approach the build a minimal working program and improve it while reaching its limits

Features

Sequential execution

$ ls || echo "Hello World"
# Same as
$ ls ; echo "Hello World"
# Same as
$ ls && echo "Hello World"

Piping

$ ls | cat

Sudo Substiution

Sudo can be invoked by using ! at the end of a command

$ sudo ls

# equal to

$ ls !

Comes in handy especially when forgetting to use sudo at the beginning of the command

Arithmetic Evaluation

Calculations have to start with a $

$ $ 1 + 1
2

Reserved keyword it for using last result

$ $ 1 + 1
2
$ $ it + 3
5

On the fly arithmetic evaluation which shows the result while typing

Arithmetic Evaluation

Todo

  • Make Signal Handling proper (use rustyline or signal_hook?)
  • Clip Board
  • Improve UI
  • Handle command splitting
  • Implement PATH search and correct command handling (depending on slash)
  • Autocompletion menu and man page/command line autocompletion
  • Handle piping
  • Make Alias System
  • Integration of CMS
    • Git
    • SVN
  • Build a config system (python?)
    • Command Bar (UI)
    • Aliases
  • Use opiniated builtin alternatives to the GNU/Unix tools
  • Tests! (look for good mock library)
  • Thinking of ways to improve shell workflows (own opinion)
  • Read more
  • Setup a more solid test environment, like the exa project with vagrant

Custom Builtins

Sources

civa's People

Contributors

hallerpatrick avatar

Stargazers

 avatar  avatar

Watchers

 avatar

civa's Issues

Civa should crash on wrong input

Example:

´´´bash
...
´´´

Error:
thread 'main' panicked at 'called Result::unwrap() on an Err value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', src/env/environment.rs:141:9
stack backtrace:
0: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
1: core::fmt::write
2: std::io::Write::write_fmt
3: std::panicking::default_hook::{{closure}}
4: std::panicking::default_hook
5: std::panicking::rust_panic_with_hook
6: rust_begin_unwind
7: core::panicking::panic_fmt
8: core::option::expect_none_failed
9: civa::env::environment::EnvManager::canonicalize_path
10: civa::command::handler::handle_commands
11: civa::main
12: std::rt::lang_start::{{closure}}
13: std::panicking::try::do_call
14: __rust_maybe_catch_panic
15: std::rt::lang_start_internal
16: main
note: Some details are omitted, run with RUST_BACKTRACE=full for a verbose backtrace.

Correct command parsing

command with quotes are not working yet

E.g.:

git commit -m "Hello world"

Output:
[git, commit, -m, "Hello", "world"]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.