Git Product home page Git Product logo

clio's People

Contributors

aj-bagwell avatar aljazerzen avatar jayvdb avatar matthiasgoergens avatar max-sixty avatar tommy-gilligan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

clio's Issues

Make seek work with stdin/stdout

If a file is piped in to the program stdin will be a normal file and therefore seeking should work.

This may need to get seek implemented in core rust or some nefarious hacks to steal the file handle.

Compatibility with Clap 4?

Hi there! It's me again, from #4

We're now attempting to upgrade to clap 4 (PRQL/prql#999, though dependabot will probably open a new one for a new patch release).

I'm running cargo check --features clap/deprecated -p prql-compiler, and seeing messages like:

warning: use of deprecated function `<cli::CommandIO as clap::Args>::augment_args::parse_try_from_os_str`: Replaced with `#[clap(value_parser = ...)]` with a custom `TypedValuePa
rser`
  --> prql-compiler/src/cli.rs:42:55
   |
42 |     #[clap(default_value="-", parse(try_from_os_str = Input::try_from))]
   |                                                       ^^^^^
   |
   = note: `#[warn(deprecated)]` on by default

Does this mean it requires a TypedValueParser? Would this be something we should write or would it come from clio?

Thank you as ever, clio has served us well (and deserves more installs!)

Clap 4.1.0 compat

I can look more at this from my end, but wanted to flag this is case you recognized immediately what was happening. We get a clio error on upgrading clap=4.0.30 to clap=4.1.0.

Possibly this was a breaking change from the clap side? We can raise there if so.

ref PRQL/prql#1494

Make seek work with HTTP range requests

For for formats that are use seek slot e.g. zip or sqlite it would be good to be able to avoid downloading whole file by using range requests to only get bits needed.

Warnings from clap 3.2

Following on from #1, we're getting some warnings since upgrading to Clap 3.2 in PRQL/prql#597

warning: use of deprecated variant `clap::ArgAction::StoreValue`: Replaced with `ArgAction::Set` or `ArgAction::Append`
  --> prql-compiler/src/cli.rs:48:37
   |
48 |     #[clap(default_value="-", parse(try_from_os_str = TryFrom::try_from))]
   |                                     ^^^^^^^^^^^^^^^
   |
   = note: `#[warn(deprecated)]` on by default

warning: use of deprecated variant `clap::ArgAction::StoreValue`: Replaced with `ArgAction::Set` or `ArgAction::Append`
  --> prql-compiler/src/cli.rs:51:52
   |
51 |     #[clap(short, long, default_value = "-", parse(try_from_os_str = Output::try_from))]
   |                                                    ^^^^^^^^^^^^^^^

Possibly we're doing something wrong (I actually don't know this well, the esteemed @kwigley generously implemented this).

Thank you!

Doesn't play nicely with clap 3.1's derive API

I tried this our with a newer version of clap (3.1), but was unable to compile with with errors like the following

error[E0277]: `OsString` doesn't implement `std::fmt::Display`
   --> examples/cat.rs:8:36
    |
8   |     #[clap(parse(try_from_os_str = Input::try_from_os_str), default_value="-")]
    |                                    ^^^^^ `OsString` cannot be formatted with the default formatter
    |
   ::: /Users/kwigley/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/alloc/src/macros.rs:111:39
    |
111 |         let res = $crate::fmt::format($crate::__export::format_args!($($arg)*));
    |                                       ---------------------------------------- in this macro invocation
    |
    = help: the trait `std::fmt::Display` is not implemented for `OsString`
    = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
    = note: this error originates in the macro `$crate::__export::format_args` (in Nightly builds, run with -Z macro-backtrace for more info)

This might be an issue with clap, sorry about that if that is the case! Here is an example where clap tests the same functionality: https://github.com/clap-rs/clap/blob/976f3d500ab890216e5d9929fcfc31bc7b4d16b4/tests/derive/custom_string_parsers.rs#L121

Github tags

Hi, could you please create GitHub tags for each release. That makes it easier to investigate issues with each release.

remove Deref<Path> from ClioPath

The current impl will sometimes return a path of "-" for stdin/stdout which will give wrong answers for any of the methods on path that may be used.

All the interesting methods of Path need to be implemented on ClioPath with sensible values for stdin/stdout.

Errors displayed poorly

When using this crate with clap 4.0.18 and clap's default features, if a clio type returns an error (e.g., if a path supplied to an Input argument does not exist), then the resulting error message from clap will just be, e.g., "error: No such file or directory (os error 2)" instead of the typical "error: Invalid value 'bad-path.txt' for '--infile <INFILE>': No such file or directory (os error 2)".

The only way I am aware of to fix this would be, in your TypedValueParser implementation, instead of converting to a clap::Error using Into/?, follow the error construction steps seen here. Unfortunately, this method does not seem to let you set a custom message or source error to display in the final error message, and I'm not even sure if it would work under clap 3.

More configuration options on `OsStrParser` (maybe making it a "PathParser`?)

In mapping click concepts to this library,

  • CachedInput, Input and Output line up with File
  • InputPath and OutputPath sort of line up with File with lazy = true
  • InputPath and OutputPath lines up with Path but none of Paths config options.

It seems like Path config options would belong as settings on OsStrParser so a user can pass in a custom value parser when the defaults expressed through the types don't quite work

does not compile on rust 1.65.0

Because it relies on PathBuf::as_mut_osstring() which was stabilized in rust 1.70.0 it does not work on older version such as the one used by Debian. This makes packaging things that depend on Clio impossible.

Add directory arg support

Would it make sense to expand this crate to include directory args?

I created a simple --path arg at Electron100/butane#130 , and it was not simple to do with builder pattern, and needs to be more complicated to be correct. It should be easier, and a clio helper could provide it.

Then there are variations for whether the directory should exist already, or the user has sufficient permissions to create it.

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.