aboutsummaryrefslogtreecommitdiff
path: root/bin/br
Commit message (Collapse)AuthorAgeFilesLines
* Refactor br(1), brxs(1), add xgo(1) and xgoc(1)Tom Ryder2016-08-141-23/+1
| | | | Including updating keybindings
* Stop feh(1) handling GIFsTom Ryder2016-08-141-0/+1
| | | | (Because it doesn't)
* Add tentative enhancements to br(1)Tom Ryder2016-08-141-1/+22
|
* Add brxs(1)Tom Ryder2016-08-131-1/+1
|
* Add br(1)Tom Ryder2016-08-131-0/+3
itle='author Tom Ryder <tom@sanctum.geek.nz> 2016-08-19 15:59:46 +1200 committer Tom Ryder <tom@sanctum.geek.nz> 2016-08-19 16:00:35 +1200 Translate apf(1) to POSIX sh' href='/cgit/dotfiles.git/commit/man/man1/apf.1?h=v1.1.0&id=475e31ca38054b5abb51fc4eae7c654fe573b72d'>475e31ca
e27810d8



475e31ca
e27810d8
475e31ca


e27810d8







475e31ca
f5b08deb
475e31ca






fdc8fa8d
475e31ca
e27810d8
475e31ca





e27810d8

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
                                               







                                         










                                                                               
                                                               

                            
             

                       
                                
  



                     
  
                 


                                                                            







                                              
  
                                                           






                                                    
                                                                     
  
                                                               





                                                                              

                               
.TH APF 1df "August 2016" "Manual page for apf"
.SH NAME
.B apf
\- add arguments to a command from a file
.SH SYNOPSIS
.B apf
foorc
foo --bar baz
.SH DESCRIPTION
Add newline-delimited arguments read from a file to a command's arguments
(before any given ones) before running it. This is intended as a quick way of
implementing *rc files for interactive shell calls to programs that don't
support such files, without having to use broken environment variables like GNU
grep(1)'s GREP_OPTIONS.
.P
This enables you to use arguments with shell metacharacters and spaces in them
that you do not want expanded. The only exception is that you cannot have
newlines in any of the arguments. This was done to keep POSIX sh(1)
compatibility.
.P
For example, given this simple program in our $PATH, printargs:
.P
    $ cat /usr/bin/printargs
    #!/bin/sh
    printf '%s\\n' "$@"
.P
Which just prints its arguments:
.P
    $ printargs a b c
    a
    b
    c
.P
We could do this:
.P
    $ printf '%s\\n' -f --flag --option '? foo bar *' > "$HOME"/.printargsrc
.P
    $ apf "$HOME"/.printargsrc printargs a b c
    -f
    --flag
    --option
    ? foo bar *
    a
    b
    c
.P
We could then make a permanent wrapper script in two lines:
.P
    $ cat >~/.local/bin/printargs
    #!/bin/sh
    exec apf "$HOME"/.printargsrc /usr/bin/printargs
    ^D
    $ chmod +x ~/.local/bin/printargs
.P
Or just a shell function, if it's only wanted for interactive shells:
.P
    $ printargs() { apf "$HOME"/.printargsrc printargs "$@" ; }
.P
It's not considered an error if the file doesn't exist or is empty. If it's a
directory or otherwise not byte-readable, an error will be printed to stderr,
but execution of the called program will continue anyway. Blank lines or lines
beginning with # are also ignored. Both leading and trailing whitespace is
preserved.
.SH AUTHOR
Tom Ryder <tom@sanctum.geek.nz>