Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using requires option crashes the application #613

Closed
workanator opened this issue Aug 1, 2016 · 2 comments
Closed

Using requires option crashes the application #613

workanator opened this issue Aug 1, 2016 · 2 comments
Labels
C-bug Category: Updating dependencies
Milestone

Comments

@workanator
Copy link

Hello,

I have an application which were running smooth unless I added a new command line argument which requires other. When I added the argument the application started to crush on cli.yml parsing.

Here is the part my cli.yml. Please notice skip_details argument here.

name: application
version: 0.3.0
args:
    - verbose:
        short: v
        multiple: false
        help: Sets the level of verbosity
subcommands:
    - ftp:
        about: Perform operation using FTP Client
        version: 0.2.0
        args:
            - list:
                short: l
                long: list
                help: List files in the given path
            - skip_details:
                long: skip-details
                help: Skip executing additional FTP commands in --list mode.
                requires: list

And here is the backtrace of my application run.

thread '<main>' panicked at 'called `Option::unwrap()` on a `None` value', ../src/libcore/option.rs:325
stack backtrace:
   1:        0x10450dc1b - std::sys::backtrace::tracing::imp::write::h3800f45f421043b8
   2:        0x10450f8f5 - std::panicking::default_hook::_$u7b$$u7b$closure$u7d$$u7d$::h0ef6c8db532f55dc
   3:        0x10450f52e - std::panicking::default_hook::hf3839060ccbb8764
   4:        0x104500d87 - std::panicking::rust_panic_with_hook::h5dd7da6bb3d06020
   5:        0x10450feb6 - std::panicking::begin_panic::h9bf160aee246b9f6
   6:        0x104501808 - std::panicking::begin_panic_fmt::haf08a9a70a097ee1
   7:        0x10450fb0f - rust_begin_unwind
   8:        0x104535d90 - core::panicking::panic_fmt::h93df64e7370b5253
   9:        0x10453608c - core::panicking::panic::h9d5bd65bbb401959
  10:        0x104475fd2 - _<std..option..Option<T>>::unwrap::hd3a293e3137a3702
  11:        0x1043ee3a3 - clap::args::arg::Arg::from_yaml::hc10920fc2443ee2d
  12:        0x10438511d - _<app..App<'a, 'a> as std..convert..From<&'a yaml_rust..Yaml>>::from::h64e34d32683ea4af
  13:        0x104382c9b - clap::app::App::from_yaml::he42602ec75f0a4f0
  14:        0x1043ef23b - clap::args::subcommand::SubCommand::from_yaml::hfea79b6b081c20c8
  15:        0x10438532c - _<app..App<'a, 'a> as std..convert..From<&'a yaml_rust..Yaml>>::from::h64e34d32683ea4af
  16:        0x104382c9b - clap::app::App::from_yaml::he42602ec75f0a4f0
  17:        0x104094144 - download::main::h25fc507b71d1853f
  18:        0x10450f11d - std::panicking::try::call::hbbf4746cba890ca7
  19:        0x1045125db - __rust_try
  20:        0x104512575 - __rust_maybe_catch_panic
  21:        0x10450ef41 - std::rt::lang_start::hbcefdc316c2fbd45
  22:        0x1040a6d39 - main
@kbknapp
Copy link
Member

kbknapp commented Aug 20, 2016

Thanks for filing this! I'll look into what's causing this and post back with what I find.

@kbknapp kbknapp added C-bug Category: Updating dependencies P1: urgent labels Aug 20, 2016
@kbknapp kbknapp added this to the 2.10.1 milestone Aug 20, 2016
kbknapp added a commit that referenced this issue Aug 20, 2016
One can now use a list or single value for certain Arg YAML declarations
such as possible_values, etc.

Prior to this commit, if only a single value was desired one would have
to use the format:

```yaml
possible_values:
    - value
```

But now once can use

```yaml
possible_values: value
```

Closes #614
Closes #613
@kbknapp
Copy link
Member

kbknapp commented Aug 20, 2016

This looks like a duplicate of #614 (or rather that is a duplicate of this issue). This will be fixed with #620

homu added a commit that referenced this issue Aug 20, 2016
feat(YAML): allows using lists or single values with arg declarations

One can now use a list or single value for certain Arg YAML declarations
such as possible_values, etc.

Prior to this commit, if only a single value was desired one would have
to use the format:

```yaml
possible_values:
    - value
```

But now once can use

```yaml
possible_values: value
```

Closes #614
Closes #613
@homu homu closed this as completed in #620 Aug 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Updating dependencies
Projects
None yet
Development

No branches or pull requests

2 participants