1RIFLE(1) rifle manual RIFLE(1)
2
3
4
6 rifle - ranger's file opener
7
9 rifle [--help] [-f FLAGS] [-l] [-p KEYWORD] [-w PROGRAM] [-c
10 CONFIG_FILE] files
11
13 rifle is a powerful file executor that allows for complex file type
14 checking, written to meet the needs of the file manager ranger.
15 rifle's strength lies in automatically determining file types,
16 depending on which programs are installed on the system, even without
17 any user interaction.
18
20 -f FLAGS Specify flags for opening the files. Flags are letters
21 that changes how the program is executed. Any
22 combination of flags will work. Writing uppercase flags
23 will negate the effect of all previously used lowercase
24 flags of the same letter.
25
26 Table of all flags:
27 f fork program to background
28 r run program as root, using sudo
29 t run program in a separate terminal, as specified by
30 $TERMCMD
31
32 -l List all possible ways to open the specified files. Each
33 line will contain information in the format of
34 id:label:flags:command. id is the identification number.
35 label is an arbitrary string that was specified for this
36 command, flags are the flags that are used by default,
37 and command is the command that is going to be executed.
38
39 -p KEYWORD Pick a method to open the files.
40
41 KEYWORD is either the ID number listed by "rifle -l" or a
42 string that matches a label in the configuration file.
43
44 -w PROGRAM Open the files with the program PROGRAM
45
46 -c CONFIG_FILE
47 Read configuration from CONFIG_FILE, instead of the
48 default.
49
50 -h, --help Print a list of options and exit.
51
53 rifle shares configuration files with ranger, though ranger is not
54 required in order to use rifle. The default configuration file
55 rifle.conf is expected to be at ~/.config/ranger/rifle.conf. However,
56 this can be overridden with the -c option.
57
58 This file specifies patterns for determining the commands to open files
59 with. The syntax is described in the comments of the default
60 rifle.conf that ships with ranger. To obtain it, you need to run:
61 "ranger --copy-config=rifle"
62
64 VISUAL Determines which editor to use for editing files.
65
66 EDITOR Determines which editor to use for editing files if VISUAL is
67 undefined or empty (in the default rifle.conf). If both are
68 undefined or empty, "vim" is used instead.
69
70 PAGER Determines which pager to use for displaying files (in the
71 default rifle.conf).
72
73 TERMCMD Determines the terminal emulator command for use with the t
74 flag. It is required that the value is the path to an
75 executable file which accepts the "-e COMMAND" argument.
76
77 XDG_CONFIG_HOME
78 Specifies the directory for configuration files. Defaults to
79 $HOME/.config.
80
82 List all the different methods:
83
84 $ rifle -l helloworld.py
85 0:editor::"$EDITOR" -- "$@"
86 1:pager::"$PAGER" -- "$@"
87 2:::python -- "$1"
88
89 Display its content by opening it with "cat":
90
91 $ rifle -w cat helloworld.py
92 print("Hello World!")
93
94 Run it by picking the method 2, which calls 'python -- "$1"':
95
96 $ rifle -p 2 helloworld.py
97 Hello World!
98
99 Display the file in a pager inside a new terminal, run as root:
100
101 $ rifle -p 1 -f tr helloworld.py
102
103
104
1052019-12-31 rifle-1.9.3 RIFLE(1)