Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Mar 01 2020 13:10
    pksunkara commented #1711
  • Mar 01 2020 13:09
    pickfire commented #1711
  • Mar 01 2020 13:07
    pickfire commented #1710
  • Mar 01 2020 12:14
    bors[bot] commented #1710
  • Mar 01 2020 12:14
    CreepySkeleton commented #1710
  • Mar 01 2020 12:09
    CreepySkeleton commented #1710
  • Mar 01 2020 12:09
    CreepySkeleton commented #1710
  • Mar 01 2020 12:08
    pksunkara review_requested #1710
  • Mar 01 2020 11:49
    pickfire commented #1710
  • Mar 01 2020 11:47
    pksunkara commented #1711
  • Mar 01 2020 11:44
    pickfire opened #1711
  • Mar 01 2020 11:44
    pickfire labeled #1711
  • Mar 01 2020 11:36
    pickfire synchronize #1710
  • Mar 01 2020 09:10
    pickfire commented #1710
  • Mar 01 2020 09:09
    pickfire opened #1710
  • Mar 01 2020 08:30
    pksunkara commented #1655
  • Mar 01 2020 08:29
    pickfire commented #1655
  • Feb 29 2020 16:49
    bors[bot] closed #1709
  • Feb 29 2020 16:49
    bors[bot] commented #1709
  • Feb 29 2020 16:07
    pksunkara commented #1709
Jean Manguy
@jeanmanguy
I know about it, but I discarded it because I already had clap working before, but maybe it can help
Matthew Pocock
@drdozer
hi - I am using clap 3 beta and the Clap annotation on a struct
I would like to match on the struct, and print out help if some branches of the match are hit -- is there a way to programatically print out the help?
Matthew Pocock
@drdozer
I see .print_help() but I can't see how to call it with my #[derive(Clap)] struct Opts
Denis Lisov
@tanriol
Opts::into_app()?
Matthew Pocock
@drdozer
Ah - I think that's it - I hadn't got the IntoApp trait imported
Matthew Pocock
@drdozer
so I have a sub-crate that isolates my diesel code - it has an autogenerated schema.rs, and a hand-rolled model.rs containing various querieables and insertables.
I have some "business logic" (a phrase I really don't like) that ensures that the raw data objects honour my application requirements e.g. hashed passwords are hashed
does that go into models.rs, or into some separate business logic file? This is really the API that should be used external to the crate
or does it just go direct into lib.rs?
Jonas Natten
@jnatten
Hey there, I'm trying to make a cli where the user can tag stuff with mrt -t test and then later reference the tag with mrt +test other_command. Is there a way to have a different prefix than - in clap? (Python does it like this: https://docs.python.org/3/library/argparse.html#prefix-chars)
Matthew Pocock
@drdozer
Oh sorry! Wrong room
Stephen Chavez
@redragonx
error: failed to select a version for the requirement clap = "^3.0.0-beta.1"
candidate versions found which didn't match: 2.33.0, 2.32.0, 2.31.2,
Hi all, when I try to setup clap, i get that error
used the readme as a guide.
Denis Lisov
@tanriol
The readme is for the 3.0 branch which has not been released yet. clap = "2.33" should work for the latest currently released version.
Stephen Chavez
@redragonx
Any fixes?
ok
ty
oh its you @tanriol
The rust community must be close :)
Any reason not to use 3.0 branch locally?
Denis Lisov
@tanriol
I do monitor the communication channels of the libraries I'm interested in... usually works as "come in to ask a question and never leave if the channel is quiet enough" :-)
Depends on your use case, probably. My personal rule of thumb is to use released versions only unless there's some specific reason to require a newer one.
Stephen Chavez
@redragonx
i dont plan on using the structopt feature yet.
so 2.33 it is
Mehdi Sadeghi
@mehdisadeghi
Good morning. Does someone know whether we can order subcommands? e.g. help comes first, then the rest of subcommands. Sorry for not reading the code! I'm just learning Rust and it is too much to dig into the library code.
Mehdi Sadeghi
@mehdisadeghi
Nevermind, found it! (display_order: 1000), (display_order: 1001), etc.
Howerver I have another question. How can I add default value and env option to an arguement with the clap_app! macro? e.g. (@arg BUS: "socketcan interface")
Mehdi Sadeghi
@mehdisadeghi
Found that one too! (@arg BUS: default_value[vcan0] "socketcan interface")
This channel is pure magic. You just ask the questsions. The answers appear in your mind. Have a good day!
Git User
@gitb2_gitlab
is there a way to capture all args in clap without "--" param. So I'd like to have ./myprog -a something anotherparam -e -a --anything ==>
param1: -a (something)
param2: anotherparam
param3: -e -a --anything
I've tried in yaml with "allow_hyphen_values: true and "multiple: true" but it does not work
complains that -e is not valid parameter
Denis Lisov
@tanriol
Have you tried AppSettings::TrailingVarArg?
Git User
@gitb2_gitlab
@tanriol thanks, seems to work
programmatically, gotta find a way to impl it in yaml
let m = App::from(yml).setting(clap::AppSettings::TrailingVarArg).get_matches();
and yml: "cmd" with "multiple: true" seemed to do the trick
prographo
@prographo

I really hate rust, hope someone can help me, so I can get back to programming in a language I like...

            Arg::with_name("tflag")
                .short("tf")
                .long("tflag")
                .help("Turbo on if this flag is specified"),

When I run...

error: The argument 'tflag' wasn't found

How do I make a an argument optional?

even when I specify it doesn't take a value .. same result.
                .takes_value(false)
               .required(false)
Still demands the argument.
h.e.l.p
Denis Lisov
@tanriol

@prographo

I really hate rust

I'm pretty sure that this is not the most efficient way of asking for help :-)

Anyway, your error looks like it is optional, but your code is not ready for it being absent (using macros that assume it's always present?).

stedingan
@stedingan
Hello what am i doing wrong if i want to have an argument -e and also an argument -ext or is this not possible?
Denis Lisov
@tanriol
@stedingan By default, -ext as an argument is considered the same as -e -x -t
Long arguments are normally introduced with -- like --my-ext-argument
stedingan
@stedingan
@tanriol so if i do https://paste.xinu.at/W3A/ i generate three shorts?
Arash
@areux

is there a way to have multi-word options in clap_app!?
for example in this code

(@arg dbus_start_jack: --start-jack "Start jack via dbus interface")

clap converts --start-jack to --start.

Denis Lisov
@tanriol
@areux Definitely possible if constructed in code; not sure about macros.
See docs, your question is mentioned there. TL;DR: --("start-jack")