File tree 5 files changed +23
-3
lines changed
5 files changed +23
-3
lines changed Original file line number Diff line number Diff line change 1
1
editor_command=vim
2
+ quick_editor_command=vim
2
3
print_command=cat
3
4
default_collection=scripts
Original file line number Diff line number Diff line change 2
2
3
3
---
4
4
5
- ## [ v1.0.0] ( https://github.com/cophilot/msh/tree/1.0.0 ) (2024 -??-??)
5
+ ## [ v1.0.0] ( https://github.com/cophilot/msh/tree/1.0.0 ) (2025 -??-??)
6
6
7
7
- Added ` manual ` command
8
+ - Added ` quick ` flag for the ` edit ` command
9
+ - Added ` quick-edit ` flag for the ` new ` command
8
10
9
11
---
10
12
Original file line number Diff line number Diff line change 5
5
# Edit a script in the editor
6
6
function edit_command {
7
7
require_dir $HOME_DIR
8
- edcom=$( get_editor_command)
9
8
script_name=${VALUES[0]}
10
9
10
+ edcom=$( get_editor_command)
11
+ if [ " $( is_flag_specified ' -quick' ' -q' ) " == " true" ]; then
12
+ edcom=$( get_quick_editor_command)
13
+ fi
14
+
11
15
if [ -z " $script_name " ]; then
12
16
$edcom $HOME_DIR
13
17
myexit 0
@@ -25,8 +29,10 @@ function edit_command {
25
29
26
30
# Print help for the edit command
27
31
function edit_help {
28
- log " edit|e [script-name] - Open a specified or all scripts in the editor"
32
+ log " edit|e [script-name] [flags] - Open a specified or all scripts in the editor"
29
33
log " script-name - If provided, the script with the specified name will be opened in the editor"
34
+ log " Flags:"
35
+ log " -quick|-q - Use the quick editor command"
30
36
log " "
31
37
}
32
38
Original file line number Diff line number Diff line change @@ -36,6 +36,10 @@ function new_command {
36
36
edcom=$( get_editor_command)
37
37
$edcom $sc_dir /$script_name
38
38
fi
39
+ if [ " $( is_flag_specified ' -quick-edit' ' -qe' ) " == " true" ]; then
40
+ edcom=$( get_quick_editor_command)
41
+ $edcom $sc_dir /$script_name
42
+ fi
39
43
}
40
44
41
45
# Print help for the new command
@@ -46,6 +50,7 @@ function new_help {
46
50
log " Flags:"
47
51
log " -edit|-e - Open the script in the editor after creation"
48
52
log " -man|-m - Add a manual to the script"
53
+ log " -quick-edit|-qe - Open the script in the editor after creation, using the quick editor command"
49
54
log " "
50
55
}
51
56
Original file line number Diff line number Diff line change @@ -47,6 +47,12 @@ function get_editor_command() {
47
47
echo " $editor_command "
48
48
}
49
49
50
+ # Get the quick editor command from the conf file
51
+ function get_quick_editor_command() {
52
+ local editor_command=$( get_conf " quick_editor_command" " vim" )
53
+ echo " $editor_command "
54
+ }
55
+
50
56
# Get the print command from the conf file
51
57
function get_print_command() {
52
58
local print_command=$( get_conf " print_command" " cat" )
You can’t perform that action at this time.
0 commit comments