Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

etc_alias.lua - create command alias #45

Closed
Sopor opened this issue Sep 11, 2017 · 6 comments
Closed

etc_alias.lua - create command alias #45

Sopor opened this issue Sep 11, 2017 · 6 comments
Assignees

Comments

@Sopor
Copy link
Contributor

Sopor commented Sep 11, 2017

A script that makes it possible to add command alias. So instead of writing +usersearch i only write +us. Or if you are an OP that have recently moved from ADCH++ to Luadch and you have learn to use +listreg it would be easy to add that as an alias to +usersearch and all the OP's will be happy :)

@blasti blasti self-assigned this Sep 11, 2017
@blasti
Copy link
Member

blasti commented Sep 11, 2017

will think about this

@perlaxe
Copy link

perlaxe commented Oct 11, 2021

Perhaps not the most elegant, but I solved it by changing the scripts to add an alternate commands: like in case of useruptime for example, added cmd1. But of course this makes life more difficult when you want to upgrade to newer version.

local cmd = "useruptime"
local cmd1 = "uu"

...

if (( command == cmd ) or ( command == cmd1 )) and param1 then

...

    assert( hubcmd.add( {cmd,cmd1}, onbmsg ) )

@blasti
Copy link
Member

blasti commented Mar 9, 2022

Perhaps not the most elegant, but I solved it by changing the scripts to add an alternate commands: like in case of useruptime for example, added cmd1. But of course this makes life more difficult when you want to upgrade to newer version.

local cmd = "useruptime" local cmd1 = "uu"

...

if (( command == cmd ) or ( command == cmd1 )) and param1 then

...

    assert( hubcmd.add( {cmd,cmd1}, onbmsg ) )

Your approach is correct. Note, that if you use hubcmd.add, you don't have to check ( command == cmd ) in the registered function onbmsg. This is already checked by hubcmd:

So, to add aliases, basically do:

-- define commands and its aliases
local cmd = { "useruptime", "uu", "ut" }
-- add some menu entry for the first command
ucmd.add( ucmd_menu_ct1_2, cmd[1], { }, { "CT1" }, minlevel )
-- register commands
assert( hubcmd.add( cmd, onbmsg ) )

I added this for usr_uptime.lua in d06f921

@blasti blasti closed this as completed Mar 9, 2022
@Sopor
Copy link
Contributor Author

Sopor commented Mar 22, 2022

I don't get it? Alias for one command and it is way to complex for us regular guys that don't code ☹

My suggestion was to create an alias script that was easy to edit and add and change alias for most of the commands you use in Luadch.

And when you update Luadch you have to edit every single script that you have added an alias to. Not very practical.

For this to work it must be very easy to add an alias.

You simple write +alias add usersearch us and usersearch now have a new alias called us.

To remove an alias you write +alias remove usersearch us.

@blasti
Copy link
Member

blasti commented Mar 22, 2022

Give me a complete list of aliases you think to be useful, and I'll officially add it.

But there are more important things to do then to write such a script.

@Sopor
Copy link
Contributor Author

Sopor commented Mar 24, 2022

I asked for this for almost 5 years ago. No hurry, It can wait another 5 years.

There is no need to do it half way. Do it right or not at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants