Skip to content
This repository was archived by the owner on Sep 14, 2023. It is now read-only.
This repository was archived by the owner on Sep 14, 2023. It is now read-only.

Docopt causes nil value panic when called with no arguments. #89

Closed
@alexchandel

Description

@alexchandel

The following minimal docopt program, which takes no parameters, panics when called without any arguments:

#![feature(plugin, core)]

extern crate "rustc-serialize" as rustc_serialize;
extern crate docopt;
#[plugin] #[no_link] extern crate docopt_macros;

docopt!(Args derive Debug, "
Usage: misc [options]

Options:
  -h, --help        Show this message.
");

fn main() {
    let _ = Args::docopt().decode().unwrap_or_else(|e| e.exit());
}

The panic message is:

thread '<main>' panicked at 'I don't know how to read into a nil value.', ~/.cargo/registry/src/github.com-1ecc6299db9ec823/docopt-0.6.33/src/lib.rs:944
An unknown error occurred

This should not happen, because it makes it impossible to have a program take no arguments and read from stdin, with '[-]'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions