From ab270f6797d4a974c0b25167c78482cb818a0e07 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Mon, 9 Sep 2013 22:23:23 -0400 Subject: Use `events.ARG_NONE` constant instead of string. --- core/args.lua | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'core/args.lua') 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 -- cgit v1.2.3