HELP
The HELP command shows a quick guide about commands, parameters and flags that are available in CardAK. It is intended as a quick reminder of how to use the tool that sometimes helps us to avoid going to the full documentation.
There are two main ways to get help, the first one is with the HELP command and the second one is adding the --help flag.
HELP command
If we just include the HELP command, the full list of available commands and global flags (shared by all commands) will be displayed
$ cardak help
usage: cardak [<flags>] <command> [<args> ...]
A command-line tool for analyzing files.
Flags:
--help Show context-sensitive help (also try --help-long and --help-man).
-v, --verbose Add more information displayed on some commands.
--mono Supress color on output.
--ignore Try to ignore some errors and continue processing the file
-W, --width Ignore small terminal width check and force execution
-z, --silent Suppress all output (banner, headers, summary) except the results. Specially useful for DESCRIBE command piped to a search utility like fzf
Commands:
help [<command>...]
version
chop [<flags>] <file>
convert [<flags>] <format> <files>...
create [<flags>] <file>
delete [<flags>] <file>
describe [<flags>] <field name> [<search pattern>]
distribute [<flags>] <files>...
duplicates [<flags>] <files>...
export [<flags>] <files>...
filter
list [<flags>] [<file>]
delete [<flags>] <file>
rename [<flags>] <old> <new>
copy [<flags>] <source> <destination>
add [<flags>] <file> <fields>
remove [<flags>] <file> <fields>
fix [<flags>] <files>...
grep [<flags>] <criteria> <files>...
identify* [<flags>] <files>...
import <file> <source>...
join [<flags>] <files>...
obfuscate [<flags>] <files>...
open [<file>]
print [<flags>] <files>...
replace --search=SEARCH --replace=REPLACE [<flags>] <files>...
split <files>...
validate [<flags>] <files>...
We can see detailed help for a particular command by adding the desired command as a parameter. For example, if we want to see the purpose and options for the GREP command, we can just execute this:
$ cardak help grep
usage: cardak grep [<flags>] <criteria> <files>...
Find data in files.
It can search for values regardless of the file format, and it has the ability to understand IPM records to specify in what fields to perform the search
Flags:
--help Show context-sensitive help (also try --help-long and --help-man).
-v, --verbose Add more information displayed on some commands.
--mono Supress color on output.
--ignore Try to ignore some errors and continue processing the file
-W, --width Ignore small terminal width check and force execution
-z, --silent Suppress all output (banner, headers, summary) except the results. Specially useful for DESCRIBE command piped to a search
utility like fzf
--version Display program version and exit
-T, --file-type=FILE-TYPE Filter by file type when supplying several files. File types are represented by a single letter as: I-IPM files, M-MPE files
-R, --records=RECORDS List of record numbers to be searched. Values are separated by comma (,) and ranges are indicated by the starting and ending
record separated by a hyphen (-)
-F, --fields=FIELDS List of IPM fields to list from a matching record, even if these fields don-t have a match (can use a filter name)
--summary Only display file names and the matching count for each one.
--matches Only display file names and the list of record numbers that match.
-C, --code=CODE Filter by Function Code description
Args:
<criteria> Search criteria. This is a list of criteria, elements separated by a comma (,) are ANDed together, while elements separated by a
semi-colon are ORed together. Each element consists of an optional field descriptor followed by a colon (:) and the value to search. Field
descriptors consist of an optional letter (D-DE fields, P-PDS fields) and the corresponding field number. If the field descriptor consist
of only numbers, then a three digit number is taken as a DE field, and a four digit number is taken as a PDS field. An example could be:
'DE43:Supermarket' to search for records having field DE43 that contain the string "Supermarket"
<files> List of files. This can be a single file or you can use wildcards
The same result is displayed by using the flag --help with the desired command (in this case GREP) like this:
cardak grep --help
This is handy when, for example, we entered a command with a long line and we want to add a flag but we are not sure how to use it. Instead of getting help and writing the full line again it can be easier to just add the --help flag at the end of the line, determine what we want, and repeat the last command adding or removing what we need. This is because the --help flags takes precedence and does not execute the given command.