summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--ranger/commands.py31
1 files changed, 27 insertions, 4 deletions
diff --git a/ranger/commands.py b/ranger/commands.py
index 411408eb..07c0a8d7 100644
--- a/ranger/commands.py
+++ b/ranger/commands.py
@@ -264,11 +264,34 @@ class mkdir(Command):
 	"""
 
 	def execute(self):
+		from os.path import join, expanduser, lexists
+		from os import mkdir
+
 		line = parse(self.line)
-		try:
-			self.fm.mkdir(line.rest(1))
-		except IndexError:
-			pass
+		dirname = join(self.fm.env.pwd.path, expanduser(line.rest(1)))
+		if not lexists(dirname):
+			mkdir(dirname)
+		else:
+			self.fm.notify("file/directory exists!", bad=True)
+
+
+class touch(Command):
+	"""
+	:touch <fname>
+
+	Creates a file with the name <fname>.
+	"""
+
+	def execute(self):
+		from os.path import join, expanduser, lexists
+		from os import mkdir
+
+		line = parse(self.line)
+		fname = join(self.fm.env.pwd.path, expanduser(line.rest(1)))
+		if not lexists(fname):
+			open(fname, 'a')
+		else:
+			self.fm.notify("file/directory exists!", bad=True)
 
 
 class edit(Command):
23 17:31:08 -0700 .' href='/akkartik/mu/commit/html/ex3.mu.html?h=hlt&id=3350c34a74844e21ea69077e01efff3bae64bdcd'>3350c34a ^
7b109ab6 ^
f6fd7e1b ^
7b109ab6 ^

f6fd7e1b ^
7b109ab6 ^
































3350c34a ^
7b109ab6 ^




a8fb537a ^
7b109ab6 ^
a8fb537a ^
7b109ab6 ^
a8fb537a ^
7b109ab6 ^



a8fb537a ^
3350c34a ^

7b109ab6 ^
5a3f9a31 ^
7b109ab6 ^

535fe9ac ^
3350c34a ^
535fe9ac ^
7b109ab6 ^

3350c34a ^

7b109ab6 ^







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