diff options
author | 2016-01-29 18:36:23 -0500 | |
---|---|---|
committer | 2016-01-29 18:36:23 -0500 | |
commit | e6fe3a375cd464b2cd9709e073f9cfa4ceb2a313 (patch) | |
tree | 7c8daad030510356fb0c5d3eb8bac1251510436c /core/args.lua | |
parent | 78ea692c5a7a233716e02c5897048560353793aa (diff) | |
download | textadept-e6fe3a375cd464b2cd9709e073f9cfa4ceb2a313.tar.gz textadept-e6fe3a375cd464b2cd9709e073f9cfa4ceb2a313.zip |
Added '-v' and '--version' command line parameters.
Diffstat (limited to 'core/args.lua')
-rw-r--r-- | core/args.lua | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/core/args.lua b/core/args.lua index 1b6e91bd..caddee0c 100644 --- a/core/args.lua +++ b/core/args.lua @@ -74,11 +74,18 @@ local function show_help() end if not CURSES then M.register('-h', '--help', 0, show_help, 'Shows this') + M.register('-v', '--version', 0, function() + print(_RELEASE..'\n'.._COPYRIGHT) + quit() + end, 'Prints Textadept version and copyright') -- After Textadept finishes initializing and processes arguments, remove the - -- help switches to prevent another instance from sending '-h' and '--help' to - -- the first instance, killing the latter. - events.connect(events.INITIALIZED, - function() switches['-h'], switches['--help'] = nil, nil end) + -- help and version switches in order to prevent another instance from sending + -- '-h', '--help', '-v', and '--version' to the first instance, killing the + -- latter. + events.connect(events.INITIALIZED, function() + switches['-h'], switches['--help'] = nil, nil + switches['-v'], switches['--version'] = nil, nil + end) end -- For Windows, create arg table from single command line string (arg[0]). |