From d96de08af0f6ab3ea653443f8a27c5fbc9ca3e3e Mon Sep 17 00:00:00 2001 From: hut Date: Tue, 22 Nov 2011 18:23:58 +0100 Subject: [PATCH] added doc --- afo.py | 49 ++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 38 insertions(+), 11 deletions(-) diff --git a/afo.py b/afo.py index d351cf3..56d8c4f 100755 --- a/afo.py +++ b/afo.py @@ -17,32 +17,59 @@ # Configuration file: # # It's a yaml dictionary, in the form of: -# : +# : # # For example: # py$: python2.7 $f # (png|jpg)$: feh $f $args # -# The first regular expression that matches the given file argument -# is used and its respective program is run. Sometimes it is necessary -# to open files in different ways. For example, one way to compile it -# and one way to execute it: +# ----------------------------------------------------- +# is a regular expression that matches against this string: +# ///. This way you can check for complicated +# relationships with a single regexp. For example, this regular expression +# matches images (by mime-type) except SVG's: ^image.*(? is either a string, a list or a dictionary. In case of a string, +# the command in the string is simply executed. But sometimes it is necessary +# to open files in different ways. For example, one way to compile it and one +# way to execute it: # # tex$: -# 0: pdflatex $B -# 1: epdfview $B.pdf +# compile: pdflatex $B +# view: epdfview $B.pdf # c$: -# - "$w1; $w2" # - gcc $f -o /tmp/a.out # - /tmp/a.out # /home/me/my_project/: # - cd /home/me/my_project; make # - /home/me/my_project/my_executable # -# You can then use the --way option to specify which way to run it. -# For example, "afo --way 1,2 test.c" would compile and run test.c. -# "afo test.c" would do the same, because way 0 runs way 1 and 2 in order. +# You can then use the --ways option to specify which way to run it. +# For example, "afo --ways 0,1 test.c" would compile and run test.c. # +# ----------------------------------------------------- +# Sometimes you can't be sure whether a program is installed or not. +# In this case, you can specify multiple programs which will be run in succession +# until one ends with an exit code which is not 127 (sh's exit code when a +# command is not found.) Examples: +# +# avi$: +# normal: +# - mplayer $f +# - totem $f +# fullscreen: +# - mplayer -fs $f +# - totem --fullscreen $f +# ^image: +# - +# - sxiv $f +# - feh $f +# +# ----------------------------------------------------- # If the first word in the program description starts with a "-", it will # be interpreted as a set of additional afo options: # avi$: -qf mplayer $f -- 2.11.4.GIT