chip8-rust / chip8-ui

CHIP-8 graphical emulator built with the Rust programing language
MIT License
8 stars 0 forks source link

Use docopt.rs to parse arguments, fixes #26 #28

Closed robo9k closed 9 years ago

robo9k commented 9 years ago

This change uses docopt.rs to parse command line arguments for the chip8_ui executable. From chip8_ui --help the invocation now needs to look like:

CHIP-8 user interface.

Usage:
  chip8_ui [--] <rom> | -
  chip8_ui -h | --help
  chip8_ui -V | --version

Options:
  -h, --help     Show this screen.
  -V, --version  Show version.

This means that the intro.ch8 file will no longer be the default when no ROM argument is provided - this is now an error (Invalid arguments.).

As noted in https://github.com/chip8-rust/chip8-ui/issues/26#issuecomment-89614962 the intro should still be distributed. Since there is currently no cargo install or similar and we do not provide downloads (e.g. via CI builds) either, this is an unresolved TODO.

One can now also use stdin as a ROM source, e.g. via useless-use-of-cat like

$ cat src/intro/intro.ch8 | ./target/debug/chip8_ui -

While the --version option uses the crate's version (i.e. from Cargo.toml), this does not provide useful information at the moment, since it's been fixed as 0.0.1 ever since (since we never published a release, related to #13).

jakerr commented 9 years ago

Reviewed, looks great! Feel free to merge after CI as I'm offline from now.