Common Lisp Package: COM.INFORMATIMAGO.COMMON-LISP.INTERACTIVE.BROWSER

This package exports a function to browse the directory hierarchy and load lisp files, and a few interactive commands: CD, PWD, PUSHD, POPD, MKDIR, LS, CAT, MORE, CP, MV, MAKE, GREP. License: AGPL3 Copyright Pascal J. Bourguignon 2002 - 2012 This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>

README:

FUNCTION

Public

BROWSE

COMMAND DO: Displays the contents of the working directory and allows the user to navigate in the directory tree and to load files.

CAT (&REST PATHS)

COMMAND SEE: MORE DO: Same as more, but force no pagination.

CD (&OPTIONAL PATH)

COMMAND DO: Change the working directory. ARGUMENTS: The path of the new working directory. If not given, then change to the user home directory.

CHANGE-WORKING-DIRECTORY (PATH)

DO: Sets *WORKING-DIRECTORY* to the new PATH, if it exists and is a directory path. Runs the hooks on *CHANGE-DIRECTORY-HOOK*. RETURN: *WORKING-DIRECTORY*

LESS (&REST ARGS)

COMMAND SEE: MORE

LS (&REST ARGS)

COMMAND DO: List the files or directories. OPTIONS: -L long listing: item kind, size, date, name; otherwise only name. ARGUMENTS: A list of paths possibly containing wildcards. If none is given, then "*" is used.

MKDIR (DIR &REST OTHER-DIRS)

COMMAND DO: Create the directories. ARGUMENTS: A list of paths. If name or type is not nil, then the file name is taken as the last item in the directory path.

MORE (&REST ARGS)

COMMAND DO: concatenate and paginate a list of files. ARGUMENTS: If the first argument is :PAGE, then the second arguments is either an integer giving the page height, or NIL indicating that no pagination must be done; else the page height is *TERMINAL-HEGIHT*. The other arguments are paths of files to be dumped on *STANDARD-OUTPUT*.

POPD

COMMAND DO: Unstack the working directory from the stack.

PUSHD (&OPTIONAL PATH)

COMMAND DO: Push the current working directory onto the stack, and change the working directory to the path (or home directory). SEE; POPD, CD.

PWD

COMMAND DO: Returns the current working directory.

WORKING-DIRECTORY

RETURN: The working directory.

Private

CHECK-DIRECTORIES-EXIST (PATH)

Return: whether all the directories in PATH exist; the path to the first directory that doesn't exist.

SPLIT-OPTIONS (ARGS)

ARGS: A list of strings containing options. RETURN: A list of options; a list of arguments both in the order found in ARGS, and converted to string.

Undocumented

CHILD-DIRECTORY (DIRPATH CHILD)

CURRENT-YEAR

FILES (DIRPATH &KEY (TYPE WILD) (KEEP-DOT-FILES *KEEP-DOT-FILES*))

FILTER-OUT-DOTS (LIST)

FORMAT-LS-DATE (STREAM DATE COLON AT &REST ARGUMENTS)

NOW

PARENT-DIRECTORY (DIRPATH)

PARSE-LS-DATE (STRING)

PARSE-SHORT-MONTH (SHORT-MONTH-NAME)

RELATIVIZE (PATH DEFAULT)

RESOLVE (PATH &KEY (DIRECTORY NIL))

RUNCOMMAND (NAME ARGS)

SHORTER-DATE (UNIVERSAL-TIME)

SUBDIRECTORIES (DIRPATH)

SUBDIRECTORIES-NAMES (DIRPATH &KEY (KEEP-DOT-FILES *KEEP-DOT-FILES*))

WILDER-PATH (PATH)

MACRO

Public

CP (&REST ARGS)

COMMAND Runs the CP command.

DEFCOMMAND (NAME &OPTIONAL DOCSTRING)

Define a macro named NAME taking any number of arguments, and calling the external program of same name thru the shell.

MAKE (&REST ARGS)

COMMAND Runs the MAKE command.

MV (&REST ARGS)

COMMAND Runs the MV command.

Private

GREP (&REST ARGS)

COMMAND Runs the GREP command.

VARIABLE

Public

*CHANGE-DIRECTORY-HOOK*

A list of unary functions called with the path of the new current working directory. The default list contains a hook to set the *DEFAULT-PATHNAME-DEFAULTS*. A common usage is to set the unix current working directory to the same directory, so that the *default-pathname-defaults*, the *working-directory* and the unix current working directory are all three synchronized.

*KEEP-DOT-FILES*

Whether dot-files should be shown.

*SHELL*

A function of one string argument executing it as a shell command.

*TERMINAL-HEIGHT*

The number of line displayed on the terminal. Used by functions like MORE.

Private

*TODAY*

Used as a reference to determine which short form a date must be formated as. Client code can rebind it to another universal date or set it to (now).

*VERBOSE*

Makes some functions output information on *trace-output*.

*WORKING-DIRECTORY*

The current working directory

Undocumented

*DIRECTORY-STACK*

*SCREEN-WIDTH*

*SHORT-MONTH-NAMES*