window based file picker with extensions
Bill Selig - SysAdmin
selig at xanth.msfc.nasa.gov
Sat Sep 30 00:32:22 AEST 1989
Here is some code that I submitted quite some time ago, but it must have
gotten lost. Anyway, I wrote this to be able do do some common operation
on a bunch of normally unrelated files. Thus, one can do
rm `pick`
and pick will pass back all of the chosen filen names to appear on the
command line. I also end up using pick to browse a directory. I ended up
adding extensions to look at files and also delete them in the tool
itself. I plan on doing various extension to enhance the features and to
remove a few inconveniences when I get the time, but this has been so
useful to me that I wanted to make a return contribution to the net as
partial repayment for the code and answers I've received in the past.
Note: pick works under both 3.x and 4. Feedback on problems, fixes or
suggested improvements requested.
Here is the man page, code following in a shar file:
NAME
pick - windowed file picker with extended features
SYNOPSIS
pick [ -a ] [ -r num ] [ -F y|n ] [ directory ]
DESCRIPTION
Pick provides a popup window which allows the user to choose
files from a directory listing. The most obvious application
of this is to choose some non-pattern-associated group of
files for operation via some unix command.
If directory is not specified, the current working directory
is assumed. The directory name is listed both in the frame
label and in the popup window itself. A "Done" button is
provided to signify completion. Clicking on this will cause
the chosen filenames to be sent to the standard output. Two
other buttons are provided to choose all files and to reset
all files to not chosen.
The files in the chosen directory are listed in multi-column
format if necessary and may be toggle chosen via a left
mouse click. The files '.' and '..' are never listed.
Other 'dot' files are by default not listed (see the -a
option ).
OPTIONS
-a Allows display of 'dot' files.
-r num
Specifies that the listing be formatted as columns of
num of rows per column. The default is 20.
-F y|n
If y is specified, mark directories with a trailing
slash (`/'), executable files with a trailing
asterisk (`*'), symbolic links with a trailing at-
sign (`@'), and AF UNIX address family sockets
with a trailing equals sign (`='). If n is specified,
use no trailing marks. The default is y.
EXTENDED FEATURES
CLicking the right mouse button on a file entry brings up a
menu with the choices View, Edit, Delete and ChDir.
View Brings up a TEXTSW window containing the file if it is
a regular file (e.g. not a directory) and the user has
read permission for it. This window has had editing
options disabled. This is the default menu choice.
Edit Brings up the file similarly but in a TEXTSW window
with editing options enabled. The user must also have
write permission for the file.
Delete
Deletes the file and removes it from the pick window if
it is not a directory and the user has the permission
to do so. There is no delete confirmation.
ChDir
Executes a system call to pick with the chosen direc-
tory. This new window will overlay the old. All opera-
tions in the new window must be carried out before the
calling window may be used again.
Ed's Note: FTP/Archive Server information:
Site: titan.rice.edu
Dir : sun-source
File: pick.shar
===============================================================
US MAIL: Bill Selig NASA/MSFC ES53
Huntsville, Al 35812 USA
TPC: (205)-544-7608
FTS: 824-7608
SPAN: sam::selig
INTERNET: selig at xanth.msfc.nasa.gov [128.158.1.31]
selig%sam.span at fedex.msfc.nasa.gov
BITNET: selig%sam.span at star.stanford.edu
UUCP: uunet!selig at sam.SPAN -OR- uunet!sam.span!selig
================================================================
More information about the Comp.sys.sun
mailing list