Saltar al contenido principal

HELP

El comando HELP muestra una guía acerca de los comandos, parámetros y flags que se pueden utilizar en CardAK. Sirven como un recordatorio accesible desde la línea de comandos que muchas veces nos evita tener que recurrir a la documentación.

Existen dos formas de obtener ayuda, una es usando el comando HELP y la segunda es agregando el flag --help

Comando HELP

Si solo incluimos el comando HELP, se nos va a mostrar la lista de comandos disponibles y los flags globales (compartidos por todos los comandos)

$ 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>...

También podemos ver la ayuda de un comando en particular agregando al comando HELP el nombre del comando que queremos consultar. Por ejemplo, si queremos ver para que sirve y como se usa el comando GREP, bastaría con ejecutar:

$ 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
tip

El mismo resultado se logra usando el flag --help junto con el propio comando GREP, de esta forma:

cardak grep --help

Esto resulta útil cuando, por ejemplo, escribimos una línea con un comando que contiene muchos parámetros y flags, pero queremos modificar ligeramente el resultado pero no recordamos cual es el flag correct. Entonces, basta con repetir la línea pero agregando el flag --help al final, ya que al estar presente, el comando no se ejecuta y se ignora el resto de la línea. Podemos entonces ver la ayuda, y repetirla quitando el flag --help y colocando el correcto.