diff --git a/STATUS.md b/STATUS.md index a7b32ce54..31c31590a 100644 --- a/STATUS.md +++ b/STATUS.md @@ -29,6 +29,8 @@ cntl-J for convenience. Slowly but surely adding the usage lines for all the `ffi` bindings. This is particularly important now we have the jump to function, push/pop actions. +Added `-d`, `-i` and `-a` options to `files` command. + ------ Fix `forward.lisp` defs regexp ! diff --git a/cmd/files.lisp b/cmd/files.lisp index 0d7f91ed1..8c7693409 100644 --- a/cmd/files.lisp +++ b/cmd/files.lisp @@ -7,22 +7,39 @@ options: -h --help: this help info. + -i --imm: immediate dependencies. + -a --all: recursive dependencies. + -d --dirs: directories. - Find all files that match the prefix and postfix. + Find all paths that match the prefix and postfix. prefix default "." postfix default "" eg. files ./apps/wallpaper/ .tga}) +(("-d" "--dirs") + ,(lambda (args arg) (setq opt_d :t) args)) +(("-i" "--imm:") + ,(lambda (args arg) (setq opt_i :t) args)) +(("-a" "--all") + ,(lambda (args arg) (setq opt_a :t) args)) )) (defun main () ;initialize pipe details and command args, abort on error (when (and (defq stdio (create-stdio)) - (defq args (options stdio usage))) + (defq opt_d :nil opt_i :nil opt_a :nil + args (options stdio usage))) (defq postfix (if (< (length args) 2) "." (second args)) prefix (if (< (length args) 3) "" (third args))) (if (ends-with "/" postfix) (setq postfix (most postfix))) - (each print (files-all postfix `(,prefix))))) + (defq files (files-all postfix `(,prefix))) + (when opt_i + (defq out (list)) + (each (# (each (# (push out %0)) %0)) (map (const files-depends) files)) + (setq files (unique (sort (const cmp) out)))) + (if opt_a (setq files (files-all-depends files))) + (if opt_d (setq files (files-dirs files))) + (each print files))) diff --git a/docs/reference/commands.md b/docs/reference/commands.md index b07a00f61..9ee913e60 100644 --- a/docs/reference/commands.md +++ b/docs/reference/commands.md @@ -52,8 +52,11 @@ Usage: files [options] [prefix] [postfix] options: -h --help: this help info. + -i --imm: immediate dependencies. + -a --all: recursive dependencies. + -d --dirs: directories. - Find all files that match the prefix and postfix. + Find all paths that match the prefix and postfix. prefix default "." postfix default ""