hashdeep_compare/
help.rs

1use indoc::formatdoc;
2
3/// Gets the main program help string
4pub fn help_string(version: &str) -> String {
5    format!("hashdeep-compare v{version}")
6}
7
8/// Gets the hash function's `clap` "long_about" string
9pub fn long_about_hash_string() -> String {
10    "Invokes hashdeep and generates a log file compatible with hashdeep-compare.".to_string()
11}
12
13/// Gets the hash function help string
14pub fn help_hash_string() -> String {
15
16    formatdoc!("
17        Notes:
18            This function is optional, but recommended to ensure log compatibility.
19
20            The above function call is equivalent to directly calling
21                hashdeep -l -r -o f path/to/target_dir \\
22                  > path/to/output_log.txt \\
23                  2> path/to/output_log.txt.errors
24
25            Note that if the output file or the error file already exists, the command
26            will be aborted (hashdeep-compare will not overwrite existing files).
27        "
28    )
29}
30
31/// Gets the sort function's `clap` "long_about" string
32pub fn long_about_sort_string() -> String {
33    "Sorts the entries in a hashdeep log by file path.".to_string()
34}
35
36/// Gets the sort function help string
37pub fn help_sort_string() -> String {
38
39    formatdoc!("
40        Notes:
41            hashdeep does not guarantee ordering of log entries, and ordering tends to
42            be inconsistent between runs in practice. Sorting allows comparison of
43            hashdeep logs in a text-diff tool, which may be the easiest way to compare
44            logs with uncomplicated differences.
45
46            Note that if the output file already exists, the command will be aborted
47            (hashdeep-compare will not overwrite existing files).
48        "
49    )
50}
51
52/// Gets the root function's `clap` "long_about" string
53pub fn long_about_root_string() -> String {
54    formatdoc!("
55        Changes a hashdeep log root by removing a prefix from its filepaths.
56        Any entries with filepaths that do not start with the prefix will be
57        omitted from the output."
58    )
59}
60
61/// Gets the root function help string
62pub fn help_root_string() -> String {
63
64    formatdoc!("
65        Notes:
66            This subcommand is an easy way to recover from a hashdeep run that prepended
67            unintended parent directories on all of its filepaths because of its invocation
68            directory.
69
70            Warning: The prefix is applied as simple text, without any rules related to paths.
71            If the prefix \"test\" were used on the filepath \"testdir/file.txt\",
72            the resulting filepath would be \"dir/file.txt\".
73            Splitting the text of a path component like this probably isn't what you want,
74            but there may be some clever uses for it.
75
76            Note that if the output file already exists, the command will be aborted
77            (hashdeep-compare will not overwrite existing files).
78        "
79    )
80}
81
82/// Gets the part function's `clap` "long_about" string
83pub fn long_about_part_string() -> String {
84    formatdoc!("
85        The real power of hashdeep-compare:
86        All entries will be partitioned into sets that efficiently describe the
87        similarities and differences of the two log files."
88    )
89}
90
91/// Gets the part function help string
92pub fn help_part_string() -> String {
93
94    formatdoc!("
95        Notes:
96            The output file base path will be used to name the output files by adding
97            suffixes that describe the log entries represented within; it may include
98            subdirectories. Nonexistent subdirectories will not be created; if one is
99            specified, the command will be aborted.
100
101            Note that if any of the resulting output files already exist, the command
102            will be aborted (hashdeep-compare will not overwrite existing files).
103        "
104    )
105}