#! /usr/bin/env tclsh # This is a support program for filerunner. It produces a list of # scripts that, when executed by SaveConfig, builds the config file # We are using a complex way to generate the configure file so that we can set the # order of generation independently of the order below. The "data" command just collects # the input in a somewhat organized way. We then break the command (info body data) # into a list of statements (buildCmds above). we then pick and choose the statements # in the order dictated by glob(edit_configuration_configlist). If we don't have an # entry there, the command in "data" will not be executed. The rules for selection: # 1. a nil selection gets entries from the head of the list # 2. entries are selected until a "Header" is found or a config body with a comment. # A header is " putsTrim $fid {#**************** HOTLISTS `{fill *}`} (we trigger on # at least 10 stars. # config bodies are commands with "AddConf $fid config(??) ?? {comment}" # Information on putsTrim and AddConf (including embedded scriplets) # may be found with their sources. # The config file generation, and thus the produced list, is controlled # by a list "glob(edit_configuration_configlist)" which is a loosly # encoded copy of the left hand panel of the "edit configuration" window. # glob(edit_configuration_configlist) is defined here as are the various # scripts that are used by SaveConfig. In short the content of the # "edit configuration" window is defined here. # # The glob(edit_configuration_configlist) rules: # 1) glob(edit_configuration_configlist) contains two types of entries: # a) header entries which contain a title and a search string # ( the search string is what the "edit configuration" browser uses # when the user selects a header in the left hand window.) # 2) subscripts for the configuration element to be displayed with # its comments. These entries will be of length 1. # 3) entries may contain expressions that result in one of the above. # At this time the only variable this expression may use is ::MSW # which is true if we are building for Microsoft Windows. # # Import options from the command line... they should look like: # var=val which will define the global var to have value val. # the output file name may be define with out=filename set out stdout foreach ent $argv { lassign [split $ent =] var value set $var $value } proc buildList {} { buildCmds data set lenConfigCmds [llength $::configcmds] set ::used {} set ::result {} set noCmds 0 set ent -1 foreach cmd [list {} {*}$::glob(edit_configuration_configlist)] { if {$cmd == {}} { set ind 0 } else { lassign $cmd lab head flag if {$head != {}} { # a header. set search *\*\*\*\*\*\**$head* set ind [lsearch -glob -nocase $::configcmds ${search}] } else { set search "config($lab)" set ind -1 set found 0 foreach ent $::configcmds { incr ind if {[string range $ent 0 7] != "AddConf "} {continue} set matchPart [lindex $ent 2] lassign $matchPart con pat set npat {} append npat $con "(" $pat ")" if {$matchPart == $search ||\ [string match $npat $search]} { incr found break } } if {!$found} { puts "Oops! could not find \"$search\" in configcommands" puts "working with $cmd" continue } } } set line [lindex $::configcmds $ind] set limit 0 while {[incr limit] < 100} { if {$limit > 98} { puts "can not find end of $cmd, configcmds entry $ind" return } lappend ::result $line if {$ind in $::used} { puts "configcmds entry $ind used at $noCmds for $cmd used before $limit" } lappend ::used $ind incr noCmds incr ind set line [lindex $::configcmds $ind] #if {$ind < 10} {puts "$ind $cmd"} if {[string match {*\*\*\*\*\*\**} $line] ||\ [string match "AddConf *config*" $line] ||\ $ind > $lenConfigCmds} { # puts "stop on $ind of $lenConfigCmds $line" break } } } puts "$noCmds executed of [llength $::configcmds]" set unused {} set ind -1 while {[incr ind] < [llength $::configcmds]} { if {$ind in $::used} {continue} lappend unused $ind } puts "unused commands $unused" # unset -nocomplain ::configcmds } # Here we build a list of commands in data using "info body" as # source. proc buildCmds {fun} { set cmds [info body $fun] set start 0 set end 1 set ::configcmds {} while {$end < [string length $cmds] && [incr lim] < 10000} { set end [string first \n $cmds $end] if {$end == -1} { set end [string length $cmds] } if {[info complete [set nc [string range $cmds $start $end-1]]] &&\ [set rs [string trim $nc]] != {}} { lappend ::configcmds $rs set start $end } incr end } puts "found [llength $::configcmds] commands" } # Here are the key data elements (glob(edit_configuration_configlist) # and proc data) # {{ bind} {Each entry binds}} # {{ menu} {Mail To}} # {{ exception} no_selection} set glob(edit_configuration_configlist) { {Hotlists {HOTLISTS}} hotlist runlist {{Mouse Bindings & menus} {MOUSE & KEY BINDINGS & MENUS}} bind, global-bind, menu, no_selection [expr {$::MSW ? "X-behave" : ""}] paste [expr {$::MSW ? "CB-paste" : ""}] {Commands {COMMAND CONFIGURATION}} editor cmd,diff cmd,open cmd,print cmd,term open,extensions view,extensions {Archiver/Packer {ARCHIVER/PACKER}} cmd,archive cmd,pack cmd,unarc,extensions cmd,unpack,extensions {{passwordlocker} {PASSWORD LOCKER}} passwordLocker {VFS {Type I VFS CONFIGURATION}} vfs,cache,maxentries vfs,helptable ftp,cd_pwd ftp,fastlink ftp,timeout ftp,password ftp,proxy ftp,useproxy ftp,login {{VFS TYPE II} {Type II VFS CONFIGURATION}} vfsII,config {RSYNC/SFTP {RSYNC/SFTP CONFIGURATION}} rsync,table {{USER BUTTONS} {USER BUTTON CONFIGURATION}} userButton, {HTTP {HTTP CONFIGURATION}} http,proxy {{APPEARANCE/colors } {APPEARANCE - COLORS}} gray middle_button_colors gui,color_bg gui,color_fg gui,color_cmd gui,color_select_bg gui,color_select_fg gui,color_highlight_bg gui,color_highlight_fg gui,color_handle gui,color_scheme gui,color_cursor gui,color_flash gui,color_balloonHelp_fg gui,color_balloonHelp_bg {{APPEARANCE/fonts} {APPEARANCE - FONTS}} gui,ListBoxFont gui,GuiFont gui,BalloonHelpFont {{APPEARANCE/directory/more} {APPEARANCE - DIRECTORY - OTHER}} ListBoxColumns,right ListBoxColumns,left ListBoxScripts {{APPEARANCE/SIZE/LOCATION} {APPEARANCE - SIZE - LOCATION}} geometry,main geometry,mainops geometry,textviewer geometry,qedit geometry,max geometry,min geometry,location {{APPEARANCE/windows} {APPEARANCE - WINDOWS}} columnScroll columnScrollSize middle_button_list {Shell {SHELL CONFIGURATION}} shell,aliases shell,buffer shell,height,left shell,height,right ask,dir_delete ask,file_delete ask,save_modified_file autoupdate balloonhelp positiondirs cd_pwd check_ownership create_relative_links dateformat DisplayName DisplayNameShare fast_checkboxes fileshow,all fileshow,dirs fileshow,sort sortoption focusFollowsMouse inotify_flags inotify_rate_limit inotify_nlflags keyb_support logsize mwheel,delta mwheel,neg mwheel,pos save_conf_at_exit spellingFilter spellcheck,expect {miscellaneous {MISC CONFIGURATION}} startpwd,left startpwd,right search,limit search,CmdConfStrings search,ViewEditStrings [expr {$::MSW ? "" : "monitors"}] [expr {$::MSW ? "" : "manualMonitors"}] {{Dangerous stuff} {DANGEROUS}} [expr {$::MSW ? "" : "cmd,chmod"}] [expr {$::MSW ? "" : "cmd,chown"}] cmd,cp cmd,dircp cmd,du cmd,find cmd,hardlink cmd,rm cmd,sh cmd,tail cmd,touch cmd,ucmd [expr {$::MSW ? "useDIR" : ""}] } proc translate {} { global glob # now do the substutions for windows vs unix puts "translate left using MSW=$::MSW" set glob(edit_configuration_configlist) \ [subst $glob(edit_configuration_configlist)] #puts "translate done" # At some point we might want to translate the right side as well # That would involve finding the references to ::MSW and resolving them } proc data {} { putsTrim $fid { # Generated by FileRunner `{subst "$::glob(displayVersion) on # [clock format [clock seconds]]"}` # This is the configuration file for FileRunner. It is read every time # FileRunner starts up. It is saved in a sub `{ifThis {$::MSW} {folder of # your HOME foulder, usually in "%%APPDATA%%/.fr". # %%APPDATA%% is the MS windows environment variable APPDATA. (You may # see the contents of this variable in a filerunner command window by typing # "%set env(APPDATA)" or "echo %%APPDATA%%".) FileRunner will also recognize # these possible locations for the configuration file: "%%LOCALAPPDATA%%/.fr", # "%%USERPROFILE%%/.fr"} {directory of your HOME directory, usually # "~/.config/.fr" or "~/.fr "(~ is short for the path to your home directory).}}` # The configuration file is named "config" where is the release # date of the FileRunner. New versions of FileRunner will use old config # files to build a new one with the new date. This allows old FileRunner # versions to continue to use their config files with out conflict with newer # versions. # # Make # sure to only edit values for variables that are listed. Do not add or # delete comments or other variables, since this file will be automatically # regenerated # when you do a "Edit Configuration->Save Configuration" in the menu and those # changes will be lost. # # This config file is saved to disk and reread into FileRunner when you # press the OK button in the config browser. # You can also edit this file # with a regular text editor and re-read it into FileRunner with # "Configuration->Reread Configuration" or just restart FileRunner. # (If you have the save on exit option set you should exit FileRunner by # typing "%exit" in a command window to avoid the auto save messing with # your newly edited file.) # From time to time, as FileRunner is enhanced, the 'as shipped' version # of a configuration entry may change. If you have an existing configuration # file, it will replace the 'as shipped' entry with what you have entered # or what was last shipped. To reset an entry to the current 'as shipped' # version all you need to do is to eliminate that entry from the configuration, # either with the configuration editor or another editor. That is all # that needs to be done. FileRunner will replace the missing entry with the # current 'as shipped' version. #`{ifThis {$::MSW} {# FileRunner handles file path names as # "/" separated components and not "\\" separated as windows uses. In passed # versions of FileRunner it was recommended that you use [file native] to # pass native MS windows file names. This version ALWAYS passes native # file names so that option is no longer needed and in fact will be # automaticly removed from the config file.} {}}` # Syntax note: Filerunner uses a special Exec Call Formatter (frECF) to # set up calls to external # (and some internal) programs and functions. To get details on how the # lines in this file are handled please read the "Configure # options for commands I" and II in the Tips file (see Help menu). # Patterns: The rule based commands use rules set up in this configuration # code. Most of these rules use a 'tcl string match' pattern to match the # rule or option to some string (file name, message, etc.). Here is a # summary of the match rules. For more details google the tcl string # command, match subcommand. # # * Matches any sequence of characters in string, # including a null string.`{in 1 9}``{next;in 0}` # ? Matches any single character in string.`{next}` # [chars] Matches any character in the set given by chars. If a # sequence of `{in 1 9}`the form x-y appears in chars, then any # character`{next}` between x and y, inclusive, will match.`{next;in 0}` # \x Matches the single character x.`{next}` # #`{ifThis {$::MSW} {# Some useful things you may need here: # [namespace exists freewrap] is true only in the fr*.exe version of fr.`{next}` # If you are having trouble with spaces in file names try:`{next;in 1}` # [file attr 'filename' -sh]`{next}` # this replaces filename with the short name which will have # no spaces.`{next;in 0}`} {}}` # } puts $fid "ClearTheDecksHereComeANewConfig" putsTrim $fid { #**************** HOTLISTS `{fill *}` } AddConf $fid config(hotlist) 2 { # This list is what will show up in your HotList menu. (Like "bookmarks" # in a browser). Feel free to edit this list. # You can label your selections thusly: {label /home/usr/foobar} # and you can build as many levels of cascade menus as you like # with each cascade starting with an entry preceeded by "-" # thusly:`{next;in 1}` # one level {-clabel { a b c }}`{next}` # two level {first {a b {-second {c d e}}}} # or, more readably:`{next;in 0}` # set config(hotlist) {`{next;in 1}` # {-first {`{next;in 1;in 1}` # a`{next}` # b`{next}` # {-second {`{next;in 1;in 1}` # c`{next}` # d`{next}` # e`{next}` # }`{next;in 0}` # }`{next;in 0}` # }`{next;in 0}` # }`{next;in 0}` # }`{next;in 0}` # where each 'a' 'b' 'c' 'd' 'e' is an entry which also may have a label as above. # For example here is an entry for the Windows volumes:`{next}` # {-volumes {{floppy a:/} {{system volume} c:/} { d:/ }}}`{next}` # The '{}' around an entry allow spaces which otherwise seperate the entries. # White space is preserved so what ever indention format you use is kept. # Try it... } AddConf $fid config(runlist) 2 { # This list is used by the Run ... commands (Utilities menu). It contains # a list of programs that you can select and instructions on how to run them. # You may find it easier to add to this list by invoking the Run command # and selecting '' where you can use command completion and # or browsing to find the program name. # # Each entry in the list contains 2 to 5 entries as follows: # # The first entry is the display name (or 'nice' name) and the run string. # You may choose any thing you want for the display name. The run string # should contain the program name (possibly a full path name) followed by any # flags you want to code. The file(s) you are passing will replace the '%s' # in this string. If the program name contains spaces you should can either # enclose the full program name in curly braces ({}) or precede each space # with a back slash (\). `{ifThis {$::MSW} {Use '/' instead of '\' # in file names.}}` # # The second entry is the string you want to separate the files with # (should you ever pass more than one file). Usually this is a space, coded as # { }. # # The remaining two entries are 'async' 'fullname' and 'last+current' # coded in any order. # These are optional entries. # If 'async' is present the program is run # asynchronously.`{next}` If 'fullname' is coded only full filenames are passed. # `{next}` If 'last+current' is coded both the last & the currently selected # file names are passed. # Here is an example entry to run the 'thunderbird' mailer to compose a # mail message with the selected files as attachments. It will display as # 'mail-to' when the 'Run' command is invoked. # # {{mail-to {thunderbird -compose attachment='%r'}} , fullname async} # # Here is how to call emacs to diff two files: # # {{Emacs-diff {emacsclient -e {(edif-files %s %s )} &}}} # If you need to use the quotes '"' use '%' to protect them e.g.'%"'. # (Note that in the mail-to case the parameter is 'attac....'. Any spaces (except # in file names, which are autmatically escaped) will make more than one parameter # and (likely) fail. # # The display of the run list (when the run command is given) may be setup # as a cascade (or hierarchical) menu. To do this the contents of each # sub menu must be contained in '{-title sub-menu-entries}' (note the "-"). # For example # this would be the entry for two versions of running fr as root, one with # the home dir change to root's dir and one with the current home dir: `{next}` # {{-root-fr-options} { `{next;in 1;in 1}` # {{{using root's home} {sudo -H fr}} { }}`{next}` # {{{using my home} {sudo fr}} { }}`{next;in 0}` # }`{next;in 0}` # } # White space is preserved so what ever indention format you use is kept. } putsTrim $fid { #****** MOUSE & KEY BINDINGS & MENUS `{fill *}` # This is the binding list. There are two types of bindings, global and # local to a directory. Global bindings may be triggered anywhere in # filerunner's main window, except that local bindings will suppress global # bindings in the directory windows. So, for example mouse 3 can be locally # bound to ViewOne and globally bound to a menu. In a directory window mouse-3 # will do ViewOne, while outside of the directory it will bring up the menu. # Global bindings look like: # config(global-bind,event) action # local bindings look like: # config(bind,event) action # Each entry binds a key or mouse event to an action. # Legal actions are all the possible (not just those you configured # to be present) commands in the center button list, including # user defined buttons, plus the following commands from other filerunner # menus (listed below). Of these commands 'CmdRunCmd' 'Back' and # 'UpDirTree' take parameters. For 'CmdRunCmd' the parameter is # the 'nice' name of a program that must appear # in the runlist (see above). This parameter is # optional. For example, using the 'mail-to' example in the runlist, this: # # set config(bind,Button-2) {CmdRunCmd mail-to} # # will cause a mouse button 2 press to run thunderbird to bring up a mail # compose window with the selected files 'attached' to the message. # The commands 'Back' and 'UpDirTree' must be coded exactly as shown. # 'Back' pops a dir from the dir stack and makes it the current dir # (the same as the <- button). 'UpDirTree' is the same as the ^ button. # One of these commands might be bound to the Left key (left arrow). You # then might want to bind the Right key (right arrow) to 'ViewOne'. # The 'Toggle' command takes as a parameter a config item and toggles it. # For example 'Toggle config(fileshow,all)' All the binary items in the # Configuration menu may be toggled this way. Binary config options not # in this menu will, most likely not work, especially if their changes require # rebuilding the window (e.g. the keyboard support binary). # Legal values for the 'bind' command may be found in the man page (do a # google search for 'tk bind'). In general, mouse buttons 1, 2 & 3 with # modifiers 'Double, Triple, Meta, Alt, Control etc. may be used. (Do # understand that 'Double' & 'Triple' will also invoke the actions leading # to the given action, that is a Triple will also invoke the single and double. # Also, the button 1 selection will happen even if button one is also # bound to a command (this is not recommended). Also note that all printing # chars are used by the position command. If you do bind a printing character # that binding as well as the position command will be executed. # # In the list below, the first element in each entry is the 'nice' # label, the second is the actual command name. You may use either one in # bind and menu configuration. This is a list of the bindings filerunner # ships with. These may be changed or but not eliminated at your discretion # (since these are predefined they will not go away if you just eliminate them # but you may set them to null "{}" to make them do nothing): # set config(bind,Button-3) ViewOne`{next}` # set config(bind,Double-1) {DoMenu,three}`{next}` # set config(bind,Control-3) ViewDirOpposite`{next}` # set config(bind,Control-1) {DoMenu,sample}`{next}` # set config(bind,Button-2) {DoMenu,two}`{next}` # set config(global-bind,Button-3) {DoMenu,two} # Here is the current list: } foreach k $glob(buttoncmds) { putsTrim $fid "# [list $k]" } putsTrim $fid "\n" AddConf $fid {config bind,*} "" { } AddConf $fid {config global-bind,*} "" {} AddConf $fid {config menu,*} "1" { # These are the menus. Each menu is a list of commands & menu references. # a menu reference looks like 'DoMenu,name' where 'name' is the menu's # name and should appear here in a config(menu,name) description. # You may define as many menus as you like, however, only menus that # are referred to by one of the bindings listed above (and cascade menus # of those) will be built. An empty entry (i.e. {}) will generate a # separator in the menu. All of these menus may be 'torn off' by clicking # on the top entry (the '-----'). This promotes the menu to a window which # may be moved around on the screen. Torn off menus no longer have access # to the list box entry that you were on when the menu was first popped up # but they do have access to the current selection(s). To continue our # example of using the run command, here is a menu line that will give a # menu entry called 'Mail To' which will run 'thunderbird' (see the runlist # above) to bring up a compose window with the selected files attached. # # {{Mail To} {CmdRunCmd 0 mail-to}} } AddConf $fid config(no_selection) 1 { # Commands in this list will not update the selection when they are # selected via a bind command. All other commands will up date the selection # if, when they are called via a 'bind'ing, there is no current selection. # You should only add to this list if you really know what you are doing. # These commands need to know how to work without a selection. # Removing commands from this list will make the removed commands update the # selection the same as others do. } AddConf $fid config(X-behave) "" { # The X-behave option attempts to make filerunner behave more closely to # how the X11 system works on *nix systems with respect to cut and paste. # In MS Windows, there is a local "selection" and a "clipboard". In general # one makes a selection with mouse 1 (often by dragging) and then copies that # to the "clipboard" (usually with Control-C). One can then "paste" that # information into the same or another application. In filerunner and other # apps the "selection" can be "pasted" locally with out copying it to the # "clipboard". In filerunner the current selection is highlighted in color. # If a new selection is made the old highlighted selection is replaced by # the new one (including the change of highlighting). By default # does a "paste" of the selection and # and Control-v does a "paste" from the # "clibboard". # On *nix systems (Unix, Linux) a selection is always put in the "clipboard". # The Xbehave option, if 1, puts selections in the "clipboard" as soon as # they are made. # } AddConf $fid config(paste) 1 { # The "paste" configuration item allow you to define additional mouse or # key selections that do a "paste". `{ifThis {$::MSW} {This paste will be # from the current selection (i.e. the local filerunner highlighted text) # is defined to do this in the "as shipped" # filerunner.} {The standard paste characters # and are already defined. # In addition some systems # define and .}}` This info is # required for paste operations in the directory line where the paste is # intercepted to make magic happen. At the same time, any sequence named # here will result in a 'paste' being preformed (without the magic) in all # filerunner 'view' windows. If your system has other sequences for 'paste' # but you don't used them to paste in the directory line you don't need to # enter them here. Filerunner is shipped with set # as this is common in the Unix world. Syntax is the same as the Tc/Tk # bind command (see bind(n)). } AddConf $fid config(CB-paste) 1 { # This option allows you to define an optional mouse or key-board character # to "paste" from the "clipboard". The "as shipped" entry here is # , Control-Key-v # and } putsTrim $fid { #********** COMMAND CONFIGURATION *`{fill *}` } AddConf $fid config(editor) "" { # This variable should be set to the name of your favorite text # editor. This editor will be invoked when you select files and press # the "Edit" button. It is also invoked when you double click on any # file name in a list box. The text editor you choose should be an # window application, not a text-terminal application. You can start # text-terminal editors for example by launching them from inside an # xterm. E.g: "xterm -e vi %s". The editor you choose should be able to # load multiple files specified as arguments to the editor (e.g: # "emacs /tmp/foo /home/joe/bar"). The editor will be launched in the # background. # Note: If you use a path name and any elements of it contain blanks # you will need to do something like:`{next}` # set config(editor) {`{next;in 1 5}` # {c:/Program Files/Windows NT/Accessories/wordpad.exe} %s}`{next;in 0}` # You could also just put the path in you PATH env var, either in your system # environment set up or in the config file in filerunner's home directory:`{next}` # `{ifThis {$::MSW} { # global env; set env(PATH) "$env(PATH);".} { # global env; set env(PATH) "$env(PATH):"}}` } AddConf $fid config(cmd,diff) "" { # Your favorite diff command. Should be able to diff directories also. # Used in the "Diff" button command. Filerunner will wait # until the program finishes unless you put a trailing '&' here. # You should do this if your diff program opens its own window e.g. meld or # emacs. Since you asked, this is what you need here to get emacs to # diff two files:`{next}` # # set config(cmd,diff) {emacsclient -e {(ediff-files %s %s% )} &} # # If you use a non-gui program leave off the '&' and filerunner will # pop up # a window with the results.`{ifThis {$::MSW} { For windows # you might want to use "fc".} }` } AddConf $fid config(cmd,open) "" { # This rule is command for the 'Open' command (above). `{ifThis {$::MSW} { # This should be: `{next}`'{twapi::shell_start -path {%s}}'} # {I am aware of 'gnome-open' 'kde-open' and 'xdg-open' # (one file limit) and 'gvfs-open' # (runs program for each file rather than send all files to the same program.)} }` # `{next}`Mac systems use 'open'. } AddConf $fid config(cmd,print) "" { # The print command you want to use to print files. } AddConf $fid config(cmd,term) "" { # The name of your favorite terminal program. # This is the program that will be launched when you press the button # with the image of the terminal window (upper right of the file list # panels). It will be launched in the background. If you include a %s # in this command it will be replaced with the current working dir # e.g.: {konsole --workdir %s} # The command is also invoked in the current working dir. } AddConf $fid config(open,extensions) "1" { # This rule contains a list of commands and the file patterns that # are used when finding the right 'open' routine for various files. The # commands will receive a list of selected files. The first file in the # selected list are used when deciding which opener should be used. (Don't # try and open a couple of text files and images simultaneously by selecting # and pressing the open button). If you add the option "-viewtext" # last in the rule that means the command outputs a listing/view and it # should be viewed in the internal text viewer. The opening commands # will be executed in the background. Open is used to launch applications # based on the file extension, however, for some files it makes more # sense to launch the application in a 'peek' mode. For this see the # view command. } AddConf $fid config(view,extensions) "1" { # This rule contains a list of commands and the file patterns that # are used when finding the right viewer for various files. The commands # will receive a list of selected files. The first file in the selected # list is used when deciding which viewer should be used. (Don't try # and view a couple of text files and images simultaneously by selecting # and pressing the view button). If you add the option "-viewtext" # last in the rule that means the command outputs a listing/view and it # should be viewed in the internal text viewer. The viewing commands # will be executed in the background. View may be used to launch applications # based on the file extension, however, for some files what makes more # sense to launch the application in a 'peek' mode. For example you # may want to 'peek' inside a .zip file to see what it contains with: # { {unzip -lv %s} {*.zip} -viewtext } # where the '-lv' tells unzip to list the files in the package. # This is particularly true of files that are addressed by the UnArc and # the UnPack buttons where, for example we might want: # { {unzip -oqq %s} {*.zip} } # to actually unzip the file. # If the rules program name is {try open} the # indicated files will be sent to the "open" rule. This is very useful in # cases where the system may have any of several programs to 'view' files of # a given type. Here is an example that sends '*.pdf' files to the open rule: # {{try open} {*.pdf}} } putsTrim $fid { #****** ARCHIVER/PACKER CONFIGURATION `{fill *}` } AddConf $fid config(cmd,archive) "" { # This is the name of your archiver program. The archiver program is # passed the name of the directory selected and is executed in the # current directory. The archive created is supposed to contain the # contents of the directory. The default built in "tar+gz %s" creates # an archive named .tar.gz packed with tar and gzip. This # command is used in the "Arc" button command to pack/archive # directories. It can be run synchronously or in the background. # This command takes up to three parameters (%s)'s. The first is the # selected file (or directory) the second is the other panels working # directory and the third is again the selected file. Thus: # "tar -cz %s -f %s/%s.tar.gz" # is the same as "tar+gz %s" except # that the result will be put in the 'other' directory. } AddConf $fid config(cmd,pack) "" { # The name of your favorite packer command. # Used in the "Arc" button command to pack files. Run synchronously # or in the background. } AddConf $fid config(cmd,unarc,extensions) "1" { # Extensions and bindings for unarchive rules. This is a list of # commands and file name extensions. Filerunner will use this variable # when deciding which command should be used to unarchive the file when # you press the UnArc button. See above comments on the 'view' command. # Its OK to put identical rules here and in the following 'unpack' # command to, for example, unzip a file even if you push the wrong # button. } AddConf $fid config(cmd,unpack,extensions) "1" { # Extensions and bindings for unpacking rules. This is a list of # commands and file name extensions. Filerunner will use this variable # when deciding which command should be used to unpack the file when you # press the UnPack button. } putsTrim $fid { #****** PASSWORD LOCKER `{fill *}` } AddConf $fid config(passwordLocker) 1 { # All passwords that are kept by filerunner are kept here. # Each entry contains an ID and the encripted password and, # optionally a `{ifThis {$::MSW} {drive letter} {mount point}}` # followed by an optiional "flag". # # If a `{ifThis {$::MSW} {drive letter} {mount point}}` is present, # the flag controls if a "Display Name" is generated for the entry. # If a "Display Name" is generated it will be in the "HotList" and # optionally in the "volume" list # (i.e. the listing for directory "") depending on the "flag". # Recognized flag values are:`{next}` # No "Display Name" will not be generated`{next}` # Hot-only Only put it in the "HotList"`{next}` # Both or nil Put in both the "volume" and "HotList"`{next}` # # The flag may be abbreviate (to one char) and may have either case. # If a "Display Name" is generated the config(DisplayNameShare) entry # governs its formatting. # Usually the ID is a URL for the site that the password is for, # however, there is nothing that requires the ID to be a URL except # that most VFS logins use URLs to find the password. Still the password # locker access code supplies and requires a URL for the password id. # URLs have the following parts:`{next}` # "protocol" the protocol e.g. ftp, rsync, sftp, cifs`{next}` # "user" is the user name and`{next}` # "port" the port" is optional if not the standard port) # however it is part of the ID and if changed here the`{in 1 11}` # VFS handler may not find the password.`{next;in 0}` # Also, the ID most often will require the "user"`{next}` # "address" The address to be accesed with this password. # The full URL format is: "protocol://user@address:port"`{next}` # For "cifs" this looks like "cifs://user@server/share" # The password code does not require a "protocol" or a "port". So for # user password on the current machine the Id would look like: # ://user@localhost # If the password code is given an Id of "foo" it will search this # table for "://foo@localhost" # The best and easiest way to handle the password Locker is to # allow filerunner to prompt for what it needs and to indicate # at that time if the password is to be saved. If an entered password # fails you will get another chance to try. # The 'password info' has the following three parts: # A password (may be {} for sftp connections using ssh keys)`{next}` # The disk address of the ssh private key (may be a full address or # the file name if the key is in env(HOME)/.ssh)`{in 1 5;next;in 0}` # The pass phrase.`{next}` # # If any of these entries contain blanks, enclose the whole # entry in braces e.g.:`{next}` {Hello world}`{next}` # Note that filerunner will encrypt the 'password info'. # If you need to change # it you should delete the string:`{next}` #'>> list of numbers <<'`{next}` # and enter the new # info in plain text. File runner will encrypt it automatically. } putsTrim $fid { #*********** Type I VFS CONFIGURATION `{fill *}` The "Virtual File System" (VFS) grew out of the origional FTP work so some of these entries are still named for FTP while, in fact, are used in the VFS code. } AddConf $fid config(vfs,cache,maxentries) "" { # Maximum number of directory listings the cache should hold. } AddConf $fid config(ftp,cd_pwd) "" { # If true (non-zero): When doing a cd to a new directory, Filerunner # will run pwd to check where it ended up (which makes a difference # if you cd to a link which points to a directory). } AddConf $fid config(ftp,fastlink) "" { # Set this to 1 if you feel your FTP connections are fast, to 0 # otherwise. If you set it to 1, soft-links in FTP listings are # correctly identified either as links to directories or to files, # otherwise it will always think links are links to directories. } AddConf $fid config(ftp,timeout) "" { # Set timeout in seconds for VFS communication. } AddConf $fid config(ftp,password) "" { # Set password for anonymous FTP sessions. This should be your # email address. } AddConf $fid config(ftp,proxy) "" { # ******** WARNNING ***************`{next}` # With no way to test ftp proxy I fear this feature will not work.`{next}` # If you have to go through a firewall via an FTP proxy, set this # variable to the hostname of your FTP proxy. Set it to "" if you don't # have an FTP proxy. } AddConf $fid config(ftp,useproxy) "" { # 1 -> Use defined ftp proxy`{next}` # 0 -> Don't use proxy (to access hosts inside the proxy/firewall) } AddConf $fid config(ftp,login) 1 { # Place holder till we get it all moved to vfs. # If config(ftp,login) is not empty a message will be generated # each time filerunner is started suggesting that it be # either eliminated or converted to a VFS login and entered # in config(vfs,login) below. } putsTrim $fid { #****** Type II VFS CONFIGURATION `{fill *}` } AddConf $fid config(vfsII,config) "2" { # A TYPE II VFS (as defined by filerunner) is a Virtual File System (VFS) # that is constructed by setting up a set of files on the system such that # they are actually on the system drive (i.e. they are NOT really virtual). # This means you can do anything you want to with them, including passing # them to external programs. What is provided here is a rule based method # to make them appear and disappear on the system. For example, consider # a compressed "tar" archive. The filerunner 'mount' command will look in # this config variable for a set of rules (based on the file extension # in this case) to uncompressed and unpack the archive to a location # (specified in the rules) and, if desired, provide an alias named path # to the unpacked files (see 'DisplayName' under 'Miscellaneous' below). # If the rule specifies that the files are # read only, the 'unmount' command will just delete the files. If # the files are not readonly, the 'unmount' script should rebuild the # archive and replace the original file prior to deleting the files. # # The set of rules consist of the following parts: # # 1) Each rule is entered as a set of pairs with the name of the option # `{in 1 3}`followed by its value (e.g. -mount ) # "*" indicates optional. Option names may be abbreviated. # The options are:`{next}` # option value comments`{next}` # -mount * if the command has spaces, # enclose in braces `{in 1 32}` # if external program lead with exec `{next;in 0}` # -use unarc or unpack * Find the command in the given rule`{next}` # -location * The path to the VFS directory`{next}` # -display * A name to display for the directory`{next}` # -readonly 1 or 0 * 1 if a read only VFS`{next}` # -umount * A command/script to # rebuild the archive`{in 1 32}``{next;in 0}` # -dirsonly 1 or 0 * If 1 only directory names # will match the rule. `{in 1 32}`If 0 or absent # directories and files match`{next;in 0}` # -okerror {pattern} * If the mount command generates an error that # matches 'pattern' `{in 1 32}` # (tcl string match pattern) the error # is forgiven.`{next}` #`{in 0}` # The '-mount' may be omitted if '-use' is present. I.e. one or the other is required. # If the '-mount' or '-umount' command is an external program it must be proceeded by # 'exec'. This is done so internal filerunner commands may be used here. # The 'exec' is provided in the '-use' case. # Location options (each of these will be followed by a # dirname choosen by fr):`{next;in 1 3}` # a) A fixed dir (such as /tmp or ~/tmp)`{next}` # b) Filerunners tmp dir (enter as: "$frTmp")`{next}` # c) A location relative dir (., .. etc.)`{next}` # d) The opposite panels directory (enter as: "$opwd")`{next;in 0}` # # The dir name may be a pattern built from the above. # The 'DisplayName' will include this dir (and the path to it) i.e. the # 'DisplayName' will replace the path/dir in the filerunner panel. # To avoid collision, the displayed name should end with the dir name. # The following, hopefully usful variables are available for use:`{next}` # # $frTmp Filerunner's per user temp area (for -location above)`{next}` # $pwd The current panes working directory`{next}` # $opwd The other panes working directory`{next}` # $tail The selected file name with no path`{next}` # $file The selected file name with full path (same as $pwd/$tail)`{in 1 7}` # This will always show a local path to the file as # it is the location VFS files are moved to.`{next;in 0}` # $ext The selected files extension`{next}` # $nil An empty string (use with -location to prevent creation attempt)`{next}` # 2) A (glob) pattern to identify which files or directories use this rule. # `{in 1 3}`This should look just like the view command pattern(s). More # than one pattern may be used with a rule. If more than one they they # should be separated spaces with the whole group enclosed with # curly braces.`{next;in 0}` # # The as shipped version the the config file contains two example rules. # One to "mount" a tar archive. This rule will recreate the tar file on # "unmount". The other rule is to # read-only mount some of the many compressions that '7z' can unpack. (Make # sure '7z' is present and findable via the 'PATH' environment variable.) # `{ifThis {!$::MSW} { # Here is a normal mount request, to be executed with # the directory selected.`{next}` #`{next}` # {{-mount {exec echo [pwLocker::getPw root] | sudo -HS mount} `{next;in 6;in 6}` # -location $nil`{next}` # -dirsonly 1`{next}` # -umount {exec echo [pwLocker::getPw root] | sudo -HS umount -l} `{next;in 0}` # } `{next}` # {*} `{next;in 0}` # } `{next}` #`{next}` # As this will match any selection, it should be last. It depends on the # target being in /etc/fstab and will throw an error if it isn't. # }}` } putsTrim $fid { #****** RSYNC/SFTP CONFIGURATION `{fill *}` } AddConf $fid config(rsync,table) "2" { # Rsync is a program that does a very good job of copying files, especially # from one system to another. Filerunner is set up to dispatch "rsync" # in such a way that it does the copy directly with the target system # using one of the two ways it has of communication with the # remote (aka host) system (please see the rsync man page for details).`{next}` # The first way assumes that you have the remote system mounted in the # local systems file space and the copy command is the "Rsync" button.`{next}` # The second way is via VFS access to the remote system using VFSrsync. # For more on this, see below.`{next}` # In the fitst way the remote file system is mounted to the # current system such that filerunner can display it in one of the panes. # In order to do the rsync transfer filerunner needs to translate # directory names as # they appear in filerunner to the names as they appear to rsync. # Filerunner handles the following connections (with needs given): # # nfs password (translation of diretory name automatic)`{next}` # cifs password share address on the remote`{next}` # ftp share address on the remote`{next}` # sftp share address on the remote`{next}` # # The rsync table should contain an entry for each remote machine # "share". Each entry contains 5 parts {share path mode ops pwd}. # # share is the cifs "share", nfs "host" or (s)ftp host # (for nfs and cifs this is the same as the fstab entry. # `{in 1 9}`For (s)ftp # this is the same as in the dir line when first opening a # connection. # It might look like "ftp://sunsite.unc.edu" for example.`{next;in 0}` # path is the host's path to the "share" # (for nfs fr finds this in the mount info)`{in 1}` # The path should not end in "/". I.e. if the file system root # is the path, enter {}. Windows paths should be entered with # "/", not "\".`{next;in 0}` # mode the mode the rsync connection should use, # one of (shell daemon{=module} use=altnateCmd)`{in 1}` # rsync daemon mode supports implies what rsync calls modules. # The module name should appear as the last part of the share # name (i.e. share/module). The key word "daemon" need not have # the "=module" part. The use= option allows you to use a program # other than rsync. scp is a possible alternative.`{next;in 0}` # ops the option string to pass to rsync for this connection # If spaces appear in this string the whole string should be`{in 1}` # quoted with {} e.g. {-a -v}`{next;in 0}` # Passwords are kept in the "password locker" and are no longer in the # rsync table. # # Where to put the port number? Usually the remote shell is ssh. The port # should be in the "ops" like this (see man page): # # --rsh="ssh -p " where is the port number. (Note quotes) # # If 'use=scp' the port would be '-P ' (Note upper case P) # # The first entry should have a null share and path and sets the default # mode, ops and pwd. These will be used when other entries don't supply # this info. It is not actually required to have other than the default # entry for nfs connections. If the shell or use=scp mode is used, the # password may not be required (see man pages on setting up password # free ssh/scp connections). # THE SECOND WAY TO SET UP AN RSYNC CONNECTION: # # The VFSrsync package in filerunner allows you to type an "rsync" URL in # the directory window at the head of one of the file panes. In this case # the remote system (which the URL addresses) must support the access either # with an rsync daemon or one of the rsync shell access modes. The rsync VFS # package uses the entry in the rsync table to determine the "mode" of the # access and if "use=" appears, is used to access the remote. # # Example: # # set config(rsync,table) {`{next;in 1 3}` # { {} {} shell {-az} mypwd}`{next}` # {//roadracer/c c:/users/me } (uses default mode, ops)`{next}` # {ftp://ftp.yonder.com /home/me/ shell {-az}}`{next}` # {ftp://ftp.wild.com /home/me/ shell {-az --rsh="ssh -p 1022"}}`{next}` # {sftp://tame.com:1022 /home/you use=scp {-BC -P 1022}}`{next}` # }`{next;in 0}` # Note on the last entry the ':1022' port is not used but must be here # to match the sftp dir line. The actual port used is supplied by '-P 1022' # # } AddConf $fid config(vfs,helptable) "2" { # From time to time additional help is needed by some of the VFS packages # to configure themselves. This may be global (i.e. all connections # for the given package) or local to specific connections. In this table # such options may be provided. In order for these to work the target # VFS package needs to access this table. # The VFS Helptable is a list of connection option entries. The connection # which is a URL which may be more or less specific (say "sftp://") # or more specific say ("sftp://host"). # The code will find the best match # i.e. the one where all the parts of the connection (i.e. protocol, # address, user and port) either match or are absent and the most parts # match. Usually entries should be in the order of increasing specificity, # so, for example, and entry for "sftp://" would proceed one for # "sftp://some.com" # The URL parts are: "sftp" "host" "user" and "port" entered as: # "sftp://user@host::port". # At this time the VFSsftp package looks here for run time options and # also permission to use recursive access on reading or writing of # directories. The following options are supported:`{next}` # run= (default is {-oPort=$port -p})`{next}` # rcopyok= (default is {rcopyok=3} `{in 1 17;next}` # (1 means read recursive is supported, # 2 write recursive, 3 both))`{next;in 0}` # rmdirempty= (default {rmdirempty=0}`{in 1 17;next}` # (0/1 can't/can delete a non-empty dir))`{next;in 0}` # # Each option should be surrounded by braces and may contain # "$port" to reference the port. The "-p" indicates that sftp should # preserve modification times, access times, and modes.`{next}` # A example is: # # set config(vfs,helptable) {`{next}` # {sftp://foo {run=-oPort=$port -p} rcopyok=0}`{in 1 17;next}` # }`{next;in 0}` } putsTrim $fid { #****** USER BUTTON CONFIGURATION `{fill *}` # You may configure one or more generic buttons for the center button list. # Each button has a label (what you see on it) and a couple of options. # Here is the syntax: # # set config(userButton,name) {`{next}` # command `{in 1 32;next}` # label