dim-an/cod

cod doesn't parse help of nxserver correctly

Closed this issue · 2 comments

This is a very cool idea. I have been looking for something just like this, I will be trying it out much more. I mainly wanted to use it for a remote desktop application called NoMachine, to manage it you use nxserver..., I have provided the --help results from the command if you'd like, its a free to use program but does have a licensing model that we use.
nxserver_help.txt

Let me apologize now, I have dyslexia so if it doesn't make sense, you may either ask me or skip over it, no worries on my end, I am just excited about this project and wanted to provide my two cents. One of the reasons I love things like these, is that short list are a lot easier for me then piles of text.

zsh
╰─➤ /usr/NX/bin/nxserver --
--address --extended --interval --per-user --trusted
--administrator --forward-connection --mask --priority --virtual
--comment --gid --minsize --screensharing
--compress --group --node --serverlist
--destination --guest --nodegroup --system
--disable --interface --nohome --timeinterval

The commands I use is nxserver --list and nxserver --history, nxserver --terminate sessionid or username... They can be used like that, or I can throw in a username or session ID.

Some Ideas for the above

  • As you can see these are not listed above. These look like sub switches to primary commands.

  • Regex --help searches. nxserver --help --regex "\n\n^--([a-z]+)(?=\s([|<)+(\w)+(]|>)+...........)\n\n"
    I'd have to run multiple regex's through it, that's a basic guess at some regex, more just to give an idea.

you could probably sed the file and make it a language that could be parsed.

  • When I type something like nxserver --li<tab_until it is selected if its not the switch selected><space or enter or shortcut key to trigger a completion scrape in the background if needed for the usernames and session ID based on a command(nxserver --list | awk '{ print $1 }') based on the previous switch --list> now be able to tab complete that?

What formatting is it looking for? Maybe I can force feed it until the project is a little further along.

Thank you so much for your time.

Hi, thanks for your feedback.

I checked help page you provided. It's interesting and little unusual.

Quick fix to help you is to use such patch. If you apply it cod starts to recognize --list,
--history and --terminate flags (and little bit more).

You can build cod with this patch from this branch.

I don't want to merge this fix to master yet, it's not perfect and there are still a lot of flags in nxserver page, that are not covered.
So I want to tinker recognition algorithm a little bit more and cover remaining cases.

Thank you, I was able to git that branch and use go build to create it. I also logged out and back in to get everything sync'd back up, and ran cod remove nxserver before running nxserver --help to learn the command again. It does list pretty much every switch now.