Command line-using functions for Common lisp
These provide a bunch of functions of some commandline utilities, so their output can be more easily used..
The program involved.
Main functions and variables:
ps commands, the defun
ps takes as argument what aspects you want
+ps-allowed+ contains the ones available. It defaultly returns a list of
lists filled with the values as requested, but there is also a
keyword so you can take the information immediately.
Using cffi on the C interface would probably be superior.
Warning: some of the available options, like
:args produce list,
because how it works internally, tokenizing on whitespace instead of how the
ps-do where you just provide (non-keyword)variables it will fill the
variables with the associated keywords. For the reason as in the warnig
&rest for the last element, for this reason all things to query
for in the list
+ps-produce-list+ must be last.
(this is unfortunate, probably a CFFI interface would be better)
wmctrl The function
the same as the
ps one, you provide a list of stuff you want,
+wmctrl-allowed+ listing them, and there is also a
wm-list-do that works
:command is also allowed,
wmctrl doesn't(afaik) do this, but
ps command to get it anyway. (because it is useful)
(sudo) iwlist wlan0 scanning and looks at its output.
iw-scan is the main function, it defaultly returns a list for each interface
which then contains a list of plists with the different properties of the
:cell-hook that runs of each cell, and a
:hook running on each
interface.(Using latter makes the earlier moot.)
:sudo is defaultly on.
iw-cur returns the current connection.
It is the reason why the read-tab-listing package exists in j-basic.
Function of the same name runs a
pinot-search command. Turns the names of
different entries into keywords a list with keywords. Of course, pinot has to
be set up. Defaultly, the function uses the special variable contents,
*search-db*, defaulting to
(:ran-query query time time-unit) where
query is the query string.
time-unit is a symbol, but for instance microseconds is
:|ms|, because if
:|Ms| that would be different!(So symbol with lowercase.)
(:showing-of shown-cnt total-cnt), number pinot-parse tells us we got and
the number it says match the query.
(:not-identified ...stuff..)(hopefully none of that),
and for the search results,
each of the words pinot lists is plist-ified:
Commandline-acpi-user. Note that a CFFI based on the C-interface
to acpi would be superior. Earlier used the classes
because you can then have
:documentation, but it is overkill.
It consists of an
acpi command, all arguments are optional, defaultly it
acpi --everything, otherwise, see the docstring.
Provides a function
top that handles few lines of
top output(badly) and
runs the lines through a function. Defaultly the function is
top thus produces a list of plists)
Basic functions providing access to commandline. If clisp it uses clisps facility, otherwise, trivial shell.
Would be better if cl-ps-command figured out the table instead of tokenizing, but feel hardly worth the effort for me.
Use of streams, using external-program might be better, but probably hardly worth it.
Everything is under GPLv3, license included under
Jasper den Ouden