@@ -76,15 +76,25 @@ def run(self):
76
76
# Grab a cache singleton instance
77
77
cache = CMDCache ()
78
78
79
+ # Handle "$ foo" to run "foo", but display it as prompt (enabled
80
+ # "prompt" flag).
81
+ if self .arguments [0 ] in ("$" , "%" ):
82
+ command = " " .join (self .arguments [1 :])
83
+ prompt = " " .join (self .arguments )
84
+ else :
85
+ command = " " .join (self .arguments )
86
+ if "prompt" in self .options :
87
+ prompt = command
88
+ else :
89
+ prompt = False
90
+
79
91
# Get the command output
80
- command = " " .join (self .arguments )
81
92
output = cache .get (command )
82
93
83
94
# Grab our custom commands
84
95
syntax = self .options .get ("syntax" , "text" )
85
96
replace = self .options .get ("replace" , "" )
86
97
reader = csv .reader ([replace ], delimiter = "," , escapechar = "\\ " )
87
- prompt = "prompt" in self .options
88
98
dedent_output = self .options .get ("dedent-output" , 0 )
89
99
90
100
# Dedent the output if required
@@ -93,7 +103,7 @@ def run(self):
93
103
94
104
# Add the prompt to our output if required
95
105
if prompt :
96
- output = "{}\n {}" .format (command , output )
106
+ output = "{}\n {}" .format (prompt , output )
97
107
98
108
# Do our "replace" syntax on the command output
99
109
for items in reader :
0 commit comments