Skip to content

Commit 1ab8d7c

Browse files
committed
Update the usage in the README
1 parent f0953dc commit 1ab8d7c

File tree

1 file changed

+54
-24
lines changed

1 file changed

+54
-24
lines changed

README.md

Lines changed: 54 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -36,47 +36,77 @@ This will automatically install the `polyfile` and `polymerge` executables in yo
3636
## Usage
3737

3838
```
39-
usage: polyfile [-h] [--filetype FILETYPE] [--list] [--html HTML]
39+
usage: polyfile [-h] [--format {mime,html,json,sbud}] [--output OUTPUT]
40+
[--filetype FILETYPE] [--list] [--html HTML]
4041
[--only-match-mime] [--only-match] [--require-match]
41-
[--max-matches MAX_MATCHES] [--debug] [--trace] [--debugger]
42-
[--no-debug-python] [--quiet] [--version] [-dumpversion]
42+
[--max-matches MAX_MATCHES] [--debugger] [--no-debug-python]
43+
[--quiet | --debug | --trace] [--version] [-dumpversion]
4344
[FILE]
4445
4546
A utility to recursively map the structure of a file.
4647
4748
positional arguments:
48-
FILE the file to analyze; pass '-' or omit to read from
49-
STDIN
49+
FILE the file to analyze; pass '-' or omit to read from STDIN
5050
5151
optional arguments:
5252
-h, --help show this help message and exit
53+
--format {mime,html,json,sbud}, -r {mime,html,json,sbud}
54+
PolyFile's output format
55+
56+
Output formats are:
57+
mime ... the detected MIME types associated with the file,
58+
like the output of the `file` command
59+
html ... an interactive HTML-based hex viewer
60+
json ... a modified version of the SBUD format in JSON syntax
61+
sbud ... equivalent to 'json'
62+
63+
Multiple formats can be output at once:
64+
65+
polyfile INPUT_FILE -f mime -f json
66+
67+
Their output will be concatenated to STDOUT in the order that
68+
they occur in the arguments.
69+
70+
To save each format to a separate file, see the `--output` argument.
71+
72+
If no format is specified, PolyFile defaults to `--format sbud`,
73+
but this will change to `--format mime` in v0.5.0
74+
--output OUTPUT, -o OUTPUT
75+
an optional output path for `--format`
76+
77+
Each instance of `--output` applies to the previous instance
78+
of the `--format` option.
79+
80+
For example:
81+
82+
polyfile INPUT_FILE --format html --output output.html \
83+
--format sbud --output output.json
84+
85+
will save HTML to to `output.html` and SBUD to `output.json`.
86+
No two outputs can be directed at the same file path.
87+
88+
The path can be '-' for STDOUT.
89+
If an `--output` is omitted for a format,
90+
then it will implicitly be printed to STDOUT.
5391
--filetype FILETYPE, -f FILETYPE
54-
explicitly match against the given filetype or
55-
filetype wildcard (default is to match against all
56-
filetypes)
57-
--list, -l list the supported filetypes (for the `--filetype`
58-
argument) and exit
59-
--html HTML, -t HTML path to write an interactive HTML file for exploring
60-
the PDF
92+
explicitly match against the given filetype or filetype wildcard (default is to match against all filetypes)
93+
--list, -l list the supported filetypes for the `--filetype` argument and exit
94+
--html HTML, -t HTML path to write an interactive HTML file for exploring the PDF;
95+
equivalent to `--format html --output HTML`
6196
--only-match-mime, -I
62-
just print out the matching MIME types for the file,
63-
one on each line
64-
--only-match, -m do not attempt to parse known filetypes; only match
65-
against file magic
97+
"just print out the matching MIME types for the file, one on each line;
98+
equivalent to `--format mime`
99+
--only-match, -m do not attempt to parse known filetypes; only match against file magic
66100
--require-match if no matches are found, exit with code 127
67101
--max-matches MAX_MATCHES
68102
stop scanning after having found this many matches
103+
--debugger, -db drop into an interactive debugger for libmagic file definition matching and PolyFile parsing
104+
--no-debug-python by default, the `--debugger` option will break on custom matchers and prompt to debug using PDB. This option will suppress those prompts.
105+
--quiet, -q suppress all log output
69106
--debug, -d print debug information
70107
--trace, -dd print extra verbose debug information
71-
--debugger, -db drop into an interactive debugger for libmagic file
72-
definition matching and PolyFile parsing
73-
--no-debug-python by default, the `--debugger` option will break on
74-
custom matchers and prompt to debug using PDB. This
75-
option will suppress those prompts.
76-
--quiet, -q suppress all log output (overrides --debug)
77108
--version, -v print PolyFile's version information to STDERR
78-
-dumpversion print PolyFile's raw version information to STDOUT and
79-
exit
109+
-dumpversion print PolyFile's raw version information to STDOUT and exit
80110
```
81111

82112
To generate a JSON mapping of a file, run:

0 commit comments

Comments
 (0)