summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorhut <hut@lepus.uberspace.de>2015-02-17 23:29:38 +0100
committerhut <hut@lepus.uberspace.de>2015-02-17 23:42:30 +0100
commit0970723c8f14bb8986d3bd7cce49cd0d7575d32b (patch)
tree759990f3756bda06f14b99a364b0178ed50c6552 /ranger
parent677c9ae868fcab6f97f964d59c6784398e08377b (diff)
downloadranger-0970723c8f14bb8986d3bd7cce49cd0d7575d32b.tar.gz
core.fm: more sane --copy-config of commands.py
This commit makes ranger only copy a small sample commands.py to
~/.config/ranger/commands.py when running --copy-config=commands.
The default commands.py will be copied to commands_full.py instead, a
file that will not be loaded at all, and will only serve as a reference.
It can be obtained with --copy-config=commands_full

This will avoid that the average user's commands.py will break ranger
whenever she's updating ranger after using --copy-config=all.
It's necessary because commands.py contains much of the actual
program logic, but it can't be kept compatible like other configuration
files, and the user can't be expected to always keep an up-to-date
version of it.

Overview:

Removed --copy-config rule:

--copy-config=commands:  commands.py -> commands.py

New --copy-config rules:

--copy-config=commands:      commands_sample.py -> commands.py
--copy-config=commands_full: commands.py -> commands_full.py
Diffstat (limited to 'ranger')
-rw-r--r--ranger/core/fm.py6
-rw-r--r--ranger/core/main.py2
2 files changed, 5 insertions, 3 deletions
diff --git a/ranger/core/fm.py b/ranger/core/fm.py
index eb99d1f1..22908f46 100644
--- a/ranger/core/fm.py
+++ b/ranger/core/fm.py
@@ -235,14 +235,16 @@ class FM(Actions, SignalDispatcher):
         if which == 'rifle' or which == 'all':
             copy('config/rifle.conf', 'rifle.conf')
         if which == 'commands' or which == 'all':
-            copy('config/commands.py', 'commands.py')
+            copy('config/commands_sample.py', 'commands.py')
+        if which == 'commands_full' or which == 'all':
+            copy('config/commands.py', 'commands_full.py')
         if which == 'rc' or which == 'all':
             copy('config/rc.conf', 'rc.conf')
         if which == 'scope' or which == 'all':
             copy('data/scope.sh', 'scope.sh')
             os.chmod(self.confpath('scope.sh'),
                 os.stat(self.confpath('scope.sh')).st_mode | stat.S_IXUSR)
-        if which in ('all', 'rifle', 'scope', 'commands', 'rc'):
+        if which in ('all', 'rifle', 'scope', 'commands', 'commands_full', 'rc'):
             sys.stderr.write("\n> Please note that configuration files may "
                 "change as ranger evolves.\n  It's completely up to you to "
                 "keep them up to date.\n")
diff --git a/ranger/core/main.py b/ranger/core/main.py
index 9ae8e0ff..9c9ee01b 100644
--- a/ranger/core/main.py
+++ b/ranger/core/main.py
@@ -193,7 +193,7 @@ def parse_arguments():
             help="change the configuration directory. (%default)")
     parser.add_option('--copy-config', type='string', metavar='which',
             help="copy the default configs to the local config directory. "
-            "Possible values: all, rc, rifle, commands, scope")
+            "Possible values: all, rc, rifle, commands, commands_full, scope")
     parser.add_option('--fail-unless-cd', action='store_true',
             help=SUPPRESS_HELP)  # COMPAT
     parser.add_option('-m', '--mode', type='int', default=0, metavar='n',
d=8a6ad45d8d26c60b62a2a7ac8d594b3c4d1dbc45'>^
1639687b ^
33352536 ^
6070c23e ^
ee9a9237 ^
33352536 ^

ee9a9237 ^
6030d7e2 ^
ee9a9237 ^
33352536 ^
6030d7e2 ^
261b1b80 ^
6030d7e2 ^
ee9a9237 ^
33352536 ^







bfcc0f85 ^
33352536 ^
bfcc0f85 ^
9d27e966 ^
33352536 ^
bfcc0f85 ^
33352536 ^

9d27e966 ^
33352536 ^

ee9a9237 ^
6030d7e2 ^
ee9a9237 ^
33352536 ^


ee9a9237 ^
33352536 ^



b8475380 ^
7a583220 ^
33352536 ^

6030d7e2 ^
3d6450f2 ^
3d6450f2 ^
6030d7e2 ^
ee9a9237 ^
6030d7e2 ^
ee9a9237 ^
6030d7e2 ^
ee9a9237 ^
33352536 ^
6030d7e2 ^
ee9a9237 ^
6030d7e2 ^

ee9a9237 ^
6030d7e2 ^
ee9a9237 ^
33352536 ^
6030d7e2 ^
ee9a9237 ^
6030d7e2 ^

9d27e966 ^
33352536 ^

ee9a9237 ^
6030d7e2 ^
ee9a9237 ^
33352536 ^
6030d7e2 ^

3d6450f2 ^

6030d7e2 ^
ee9a9237 ^
6030d7e2 ^
ee9a9237 ^
6030d7e2 ^
ee9a9237 ^
33352536 ^
6030d7e2 ^
ee9a9237 ^
6030d7e2 ^

ee9a9237 ^
6030d7e2 ^
ee9a9237 ^
33352536 ^
6030d7e2 ^
ee9a9237 ^
6030d7e2 ^

ee9a9237 ^
6030d7e2 ^
ee9a9237 ^
33352536 ^
6030d7e2 ^
ee9a9237 ^
6030d7e2 ^

9d27e966 ^
33352536 ^

ee9a9237 ^
6030d7e2 ^
ee9a9237 ^
33352536 ^
6030d7e2 ^

b31455f8 ^


f1eade72 ^
6030d7e2 ^
9b16f190 ^
6030d7e2 ^
9b16f190 ^
bfcc0f85 ^
438e5a0d ^



6ee77ba7 ^
ee9a9237 ^
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162