File tree Expand file tree Collapse file tree 1 file changed +20
-18
lines changed
lib/msf/ui/console/command_dispatcher Expand file tree Collapse file tree 1 file changed +20
-18
lines changed Original file line number Diff line number Diff line change @@ -78,35 +78,37 @@ def cmd_edit_help
78
78
#
79
79
def cmd_edit ( *args )
80
80
editing_module = false
81
+
81
82
if args . length > 0
82
83
path = args [ 0 ]
83
84
elsif active_module
84
85
editing_module = true
85
86
path = active_module . file_path
86
87
end
87
88
88
- if path
89
- editor = local_editor
89
+ if path . nil?
90
+ print_error ( 'Nothing to edit. Try using a module first or specifying a library file to edit.' )
91
+ return
92
+ end
90
93
91
- if editor . nil?
92
- editor = 'vim'
93
- print_warning ( "LocalEditor or $VISUAL/$EDITOR should be set. Falling back on #{ editor } ." )
94
- end
94
+ editor = local_editor
95
+
96
+ if editor . nil?
97
+ editor = 'vim'
98
+ print_warning ( "LocalEditor or $VISUAL/$EDITOR should be set. Falling back on #{ editor } ." )
99
+ end
95
100
96
- print_status ( "Launching #{ editor } #{ path } " )
97
- system ( *editor . split , path )
101
+ print_status ( "Launching #{ editor } #{ path } " )
102
+ system ( *editor . split , path )
98
103
99
- # XXX: This will try to reload *any* .rb and break on modules
100
- if !editing_module
101
- if path . end_with? ( '.rb' )
102
- print_status ( "Reloading #{ path } " )
103
- load path
104
- else
105
- print_error ( "Only library files can be reloaded after editing (use reload/rerun for modules)" )
106
- end
107
- end
104
+ return if editing_module
105
+
106
+ # XXX: This will try to reload *any* .rb and break on modules
107
+ if path . end_with? ( '.rb' )
108
+ print_status ( "Reloading #{ path } " )
109
+ load path
108
110
else
109
- print_error ( 'Nothing to edit -- try using a module first, or specifying a library file to edit .' )
111
+ print_error ( 'Only library files can be reloaded after editing .' )
110
112
end
111
113
end
112
114
You can’t perform that action at this time.
0 commit comments