diff options
author | mitchell <70453897+667e-11@users.noreply.github.com> | 2013-09-09 22:23:23 -0400 |
---|---|---|
committer | mitchell <70453897+667e-11@users.noreply.github.com> | 2013-09-09 22:23:23 -0400 |
commit | ab270f6797d4a974c0b25167c78482cb818a0e07 (patch) | |
tree | d6c6e1b6929d21d2d42e373916b5dcfc34ca7f5b /core/args.lua | |
parent | 7e88330753edcf2df034e2240c2e77e1006d2e64 (diff) |
Use `events.ARG_NONE` constant instead of string.
Diffstat (limited to 'core/args.lua')
-rw-r--r-- | core/args.lua | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/core/args.lua b/core/args.lua index bbf4a074..d5712a42 100644 --- a/core/args.lua +++ b/core/args.lua @@ -8,10 +8,12 @@ local M = {} -- -- ## Arg Events -- --- + `'arg_none'` +-- @field _G.events.ARG_NONE (string) -- Emitted when no command line arguments are passed to Textadept on startup. module('args')]] +events.ARG_NONE = 'arg_none' + -- Contains registered command line switches. -- @class table -- @name switches @@ -38,7 +40,7 @@ end -- Processes command line argument table *arg*, handling switches previously -- defined using `args.register()` and treating unrecognized arguments as -- filenames to open. --- Emits an `'arg_none'` event when no arguments are present. +-- Emits an `ARG_NONE` event when no arguments are present. -- @param arg Argument table. -- @see register -- @see events @@ -65,7 +67,7 @@ function M.process(arg) end i = i + 1 end - if no_args then events.emit('arg_none') end + if no_args then events.emit(events.ARG_NONE) end end -- Shows all registered command line switches on the command line. @@ -103,4 +105,7 @@ _G._USERHOME = userhome M.register('-u', '--userhome', 1, function() end, 'Sets alternate _USERHOME') M.register('-f', '--force', 0, function() end, 'Forces unique instance') +events.connect(events.INITIALIZED, + function() if arg then M.process(arg) end end) + return M |