aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/args.lua15
-rw-r--r--core/init.lua2
-rw-r--r--doc/manual.md1
-rw-r--r--modules/textadept/menu.lua3
4 files changed, 15 insertions, 6 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]).
diff --git a/core/init.lua b/core/init.lua
index 16b4e28b..093d0faa 100644
--- a/core/init.lua
+++ b/core/init.lua
@@ -1,6 +1,8 @@
-- Copyright 2007-2016 Mitchell mitchell.att.foicica.com. See LICENSE.
_RELEASE = "Textadept 8.5"
+_COPYRIGHT = 'Copyright © 2007-2016 Mitchell. See LICENSE.\n'..
+ 'http://foicica.com/textadept'
package.path = _HOME..'/core/?.lua;'..package.path
diff --git a/doc/manual.md b/doc/manual.md
index d2584f39..d40acc8f 100644
--- a/doc/manual.md
+++ b/doc/manual.md
@@ -1681,6 +1681,7 @@ Switch |Arguments|Description
`-n`, `--nosession`| 0 |No [session](#Sessions) functionality.
`-s`, `--session` | 1 |Loads [session](#Sessions) on startup.
`-u`, `--userhome` | 1 |Sets alternate [`_USERHOME`][].
+`-v`, `--version` | 0 |Prints Textadept version and copyright
Textadept curses does not support the help switch.
diff --git a/modules/textadept/menu.lua b/modules/textadept/menu.lua
index aade04df..7647db9d 100644
--- a/modules/textadept/menu.lua
+++ b/modules/textadept/menu.lua
@@ -200,8 +200,7 @@ local default_menubar = {
SEPARATOR,
{_L['_About'],
{ui.dialogs.msgbox, {title = 'Textadept', text = _RELEASE,
- informative_text = 'Copyright © 2007-2016 Mitchell. See LICENSE\n'..
- 'http://foicica.com/textadept',
+ informative_text = _COPYRIGHT,
icon_file = _HOME..'/core/images/ta_64x64.png'}}},
},
}