Skip to content

Commit

Permalink
cleanup #7
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Feb 10, 2016
1 parent 8d5ab03 commit e355728
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
10 changes: 5 additions & 5 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ const fileType = require('file-type');
const cli = meow(`
Usage
$ opn <file|url> [--wait] [-- <app> [args]]
$ stdout | opn [--wait] [--ext] [-- <app> [args]]
$ cat <file> | opn [--wait] [--ext] [-- <app> [args]]
Options
--wait Wait for the app to exit
--ext File extension for stdin
--ext File extension for when stdin file type can't be detected
Examples
$ opn http://sindresorhus.com
$ opn http://sindresorhus.com -- firefox
$ opn http://sindresorhus.com -- 'google chrome' --incognito
$ opn unicorn.png
$ cat ./image.png | opn
$ echo '[]' | opn --ext json
$ cat unicorn.png | opn
$ echo '<h1>Unicorns!</h1>' | opn --ext=html
`, {
default: {
wait: false
Expand All @@ -33,7 +33,7 @@ cli.flags.app = cli.input.slice(1);
const input = cli.input[0];

if (!input && process.stdin.isTTY) {
console.error('Input required');
console.error('Specify a filepath or URL');
process.exit(1);
}

Expand Down
10 changes: 6 additions & 4 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,23 @@ $ opn --help
Usage
$ opn <file|url> [--wait] [-- <app> [args]]
$ stdout | opn [--wait] [--ext] [-- <app> [args]]
$ cat <file> | opn [--wait] [--ext] [-- <app> [args]]
Options
--wait Wait for the app to exit
--ext File extension for stdin
--ext File extension for when stdin file type can't be detected
Examples
$ opn http://sindresorhus.com
$ opn http://sindresorhus.com -- firefox
$ opn http://sindresorhus.com -- 'google chrome' --incognito
$ opn unicorn.png
$ cat ./image.png | opn
$ echo '[]' | opn --ext json
$ cat unicorn.png | opn
$ echo '<h1>Unicorns!</h1>' | opn --ext=html
```

The [following file types](https://github.com/sindresorhus/file-type#supported-file-types) are automagically detected when using stdin mode.


## Related

Expand Down

0 comments on commit e355728

Please sign in to comment.