Rust-Quicli: quicli — quickly build cool CLI apps in Rust

QuiCLI

Quickly build cool CLI apps in Rust.

Build Status Documentation License crates.io

Getting started

Read the Getting Started guide!

Thanks

This is only possible because of all the awesome libraries included here:

  • Structopt and Clap for the nice CLI with awesome argument handling, great error messages, and nice composability!
  • Serde for handling all things serializing and deserializing
  • failure for ergonomic error handling.
  • …and more to come!

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Comments

  • Turn on logging in all subcrates?
    Turn on logging in all subcrates?

    Aug 14, 2018

    As it is right now, the -vvv enables logging only for the main crate. For some use-cases, the ability to log everything would make more sense. Any way to achieve it?

    Right now even RUST_LOG no longer works.

    Reply
  • Ignore `-v` if `RUST_LOG` is set
    Ignore `-v` if `RUST_LOG` is set

    Aug 14, 2018

    Related to #90

                                                                                                                                                                                                           
    Reply
  • Add backtrace to errors
    Add backtrace to errors

    Oct 27, 2018

                                                                                                                                                                                                           
    Reply
  • Issue with glob in thumbnail tutorial
    Issue with glob in thumbnail tutorial

    Dec 7, 2018

    After I finished the thumbnail tutorial, I tried to test it and got this error

    Error: No files match pattern `rust_memes/*`
    

    After seeing that, I progressively commented out more code to get a minimal reproduction, and I was able to find that this block of code doesn't match anything

    use quicli::prelude::*;
    
    fn main() -> CliResult {
        let files = glob("src/*")?;
        println!("{:?}", files);
        Ok(())
    }
    
    ~/dev/rust/thumbify master
    ❯ cargo run --
       Compiling thumbify v0.1.0 (/home/chris.pickard/dev/rust/thumbify)
        Finished dev [unoptimized + debuginfo] target(s) in 1.11s
         Running `target/debug/thumbify`
    Error: No files match pattern `src/*`
    

    Even though I clearly have matching files in my src/ directory

    ~/dev/rust/thumbify master
    ❯ ls src
    main.rs
    

    I'm sorry, I feel like I'm quite a thorn in your side at the moment

    bug 
    Reply
  • Include `read_input`?
    Include `read_input`?

    Dec 14, 2018

    My crate read_input seems to line up well with the aims of quicli. It helps make CLI tools quicker and easier to make.

    It would be awesome if it could be included with quicli. Any feedback on my crate would also be welcome.

    Reply
  • bail!() no longer works with quicli 0.4
    bail!() no longer works with quicli 0.4

    Jan 16, 2019

    I think this is caused by https://github.com/rust-lang-nursery/failure/issues/258 and https://github.com/rust-lang-nursery/failure/issues/110, but I thought it worth mentioning, as I hit this upgrading from quicli 0.3 to 0.4.

    I'm not sure there's anything that can be done in this crate though, so feel free to close if you want.

    Reproduction:

    Source

    use quicli::prelude::*;
    
    fn main() -> CliResult {
        bail!("This does not work!");
    }
    

    Reproduction

    cargo new quicli_bail; cd quicli_bail
    cargo install cargo-edit
    cargo add quicli
    echo -e 'use quicli::prelude::*;\n\nfn main() -> CliResult {\n    bail!("This does not work!");\n}' >src/main.rs
    cargo build
    

    Result:

       Compiling test_quicli v0.1.0 (/Users/gib/tmp/test_quicli)
    error[E0308]: mismatched types
     --> src/main.rs:4:5
      |
    4 |     bail!("This doesn't work!");
      |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `exitfailure::ExitFailure`, found struct `failure::error::Error`
      |
      = note: expected type `exitfailure::ExitFailure`
                 found type `failure::error::Error`
      = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
    
    error: aborting due to previous error
    
    For more information about this error, try `rustc --explain E0308`.
    error: Could not compile `test_quicli`.
    
    To learn more, run the command again with --verbose.
    
    Reply
  • Use globwalk instead of glob
    Use globwalk instead of glob

    Oct 7, 2018

    implementation of #74 .

    Now, we can use {a, b} pattern.

    Reply
  • WIP: use structopt (master) 0.2
    WIP: use structopt (master) 0.2

    Feb 10, 2018

    Replaces #48.

    cc @TeXitoi

    Reply
  • add and export path_abs crate
    add and export path_abs crate

    Jan 22, 2018

    I am the creator and maintainer of the new path_abs crate and I think it solves a lot of ergonomic problems in rust (problems I see you re-solving with the fs module!).

    Questions:

    • should we export path_abs types?
    • should fs module be deprecated?

    Thanks!

    maybe - use case needed 
    Reply
  • Publish fancy guides/docs
    Publish fancy guides/docs

    Jan 22, 2018

    I want to add some more examples and show them in a nice way, but I'm not yet sure how best to do that.

    One idea:

    • Add docs/ folder that is deploy via Github Pages (with Jekyll)
    • put "literate Rust" in there (Markdown with code blocks)
    • parse the Markdown files in there with waltz and test that code as subcrate(s) on CI
    looking for feedback 
    Reply
  • fix #43: pub use crates, add set_log_verbosity and feature=full-throttle
    fix #43: pub use crates, add set_log_verbosity and feature=full-throttle

    Feb 10, 2018

    This does several things to, some of which is to integrate better with the ergo ecosystem.

    • Adds feature=full-throttle as suggested in #43, which allows disabling some of the included crates
    • Moves set_log_verbosity into a function so that users can more cleanly migrate away from the main! macro (I already had need of this in artifact).
    • Publically uses crates to improve the import story. For instance, to use clap (which is exported by quicli), I had to do: use quicli::prelude::structopt::clap, which now I can do use quicli::structopt::clap.

    I am currently using both ergo and quicli together to rewrite artifact's CLI. I'll keep opening bugs/PRs as I find them!

    Reply
  • Requirements Discussion: what is quicli?
    Requirements Discussion: what is quicli?

    Jan 22, 2018

    This is a discussion on what the use case and requirements of these two libraries are.

    stdcli's goal is basically to make creating a CLI in rust more like creating one in python from a user experience and ergonomics point of view. This means:

    • batteries included
    • almost everything you need is already imported
      • python, because of it's duct typing and general unsafetly, does not require you to import "something" to use methods on its types. Rust, on the other hand requires you to import a boatload of traits.
      • related: #18
    • "flush out" macros that should be in the stdlib like hashmap!
    • (not yet in stdcli but planned) provide feature flags to control which libraries you want so you can develop with "full batteries" and then pare everything down as your application dependencies become more clear. For instance, maybe ansi_term, pretty_tables, termstyle and tabwriter are all in the "full batteries" package, but then you can do features = ["style_termstyle"] to only have termstyle

    Also related: require that all versions in quicli are of the form >=VERSION so that the user can mostly control which version is used.

    What is quicli?

    Qui CLI seems to have similar but not completely overlapping goals. I would prefer we merge forces rather than create competing libraries.

    I think it should be possible through liberal use of feature flags to accomplish any usecase a user might want. I.e. features = "full_batteries" would depend-on-the-world, but features = "light" would give very minimal dependencies, and everything in between.

    looking for feedback 
    Reply