• # Marrant

    Posté par . En réponse au lien The Poetics of CLI Command Names. Évalué à 2.

    J’ai enfin pris le temps de lire l’article et il est vraiment drôle.

    Il y a un point qui mérite un exemple à mon avis :

    Don't depend on your command's name to determine its scope. Keep those decisions separate.

    $ ln -s /usr/bin/pgrep pkill
    $ ./pkill --version
    pkill from procps-ng 3.3.16
    $ ln -s /usr/bin/pkill foobar
    $ ./foobar --version
    foobar from procps-ng 3.3.16
    $ ./foobar -h
    Usage:
     foobar [options] <pattern>
    Options:
     -d, --delimiter <string> specify output delimiter
     -l, --list-name list PID and process name
     -a, --list-full list PID and full command line
     -v, --inverse negates the matching
     -w, --lightweight list all TID
     -c, --count count of matching processes
     -f, --full use full process name to match
     -g, --pgroup <PGID,...> match listed process group IDs
     -G, --group <GID,...> match real group IDs
     -i, --ignore-case match case insensitively
     -n, --newest select most recently started
     -o, --oldest select least recently started
     -P, --parent <PPID,...> match only child processes of the given parent
     -s, --session <SID,...> match session IDs
     -t, --terminal <tty,...> match by controlling terminal
     -u, --euid <ID,...> match by effective IDs
     -U, --uid <ID,...> match by real IDs
     -x, --exact match exactly with the command name
     -F, --pidfile <file> read PIDs from file
     -L, --logpidfile fail if PID file is not locked
     -r, --runstates <state> match runstates [D,S,Z,...]
     --ns <PID> match the processes that belong to the same
     namespace as <pid>
     --nslist <ns,...> list which namespaces will be considered for
     the --ns option.
     Available namespaces: ipc, mnt, net, pid, user, uts
     -h, --help display this help and exit
     -V, --version output version information and exit
    For more details see pgrep(1).
    $ ./foobar -laf init
    1 /sbin/init splash