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

Extending joycontrol command line syntax #107

Open
janreggie opened this issue Apr 9, 2021 · 2 comments
Open

Extending joycontrol command line syntax #107

janreggie opened this issue Apr 9, 2021 · 2 comments

Comments

@janreggie
Copy link

As it stands, the command line syntax is fairly limited. The syntax can be seen in my PR in #106. There are no control loops nor delays, and commands have to be either typed manually or be in a single line and executed sequentially, one after the other, without pause.

Proposal

  • Multiple commands in a single line using ;. The current syntax uses && to achieve this, thus ; may be treated as a synonym.
  • Commands are to be case-insensitive. That is, A; NFC file_name, a && nfc file_name and a ; nfC file_name (although the last one will look weird) should perform the same task.
  • Addition of sleep, with syntax sleep interval (interval as a float in seconds), which just tells the interpreter to pause/sleep for some amount of time. a; sleep 5; b will signal to the Switch to press the A button, wait for 5 seconds, and then press the B button.
  • For loops. This has been mentioned before in 请问循环语法可以填写无限循环吗? #84, although in Chinese. Proposing the following syntax: for COUNT ; commands ; done will repeat commands COUNT times. Example usage: for 10; a; sleep 1; b; sleep 1; done, will cause A, B, A, B, and so on to be pressed, (ideally) 1 second apart.
    • For loops can also be inside for loops: for 10; a; sleep 1; for 10; b; sleep 1; done; sleep 1; done, or graphically:
for 10
  a
  sleep 1
  for 10
    b
    sleep 1
  done
  sleep 1
done
  • For loops with delay: for COUNT DELAY; cmd1; cmd2; done is the same as for COUNT; cmd1; sleep DELAY; cmd2; sleep DELAY; done.
  • "Reading" from files using read file_path, which parses a file file_path that looks like the code block above. Comments would start with #'s.
  • Macros: Setting a macro using macro mname; cmd1; cmd2; done and using it like for COUNT; mname; done. mname shouldn't be a "reserved keyword", and be limited to not having spaces. Parameterized macros can be a thing in the future.

Breaking changes

Applications or people that already use joycontrolmust be able to still use it after the changes have been made. Nonetheless, the changes provided may introduce some bugs along the way

The addition of ; and # as key symbols and setting all commands to case-insensitive may cause issues with file_names. An intelligent parser should be able to parse the new commands.

Further changes

Comments about this proposal are welcome. I wouldn't want to make the syntax too complex, so I want this proposal to be as concise as possible. For instance, I wouldn't want to add conditional execution (if blocks) since it wouldn't really be useful.

@pokemon-bot
Copy link

I dont like putting the commands in the command line. I do like the suggestion of having all these commands in a file, with comments starting with # like mentioned.

@janreggie
Copy link
Author

I dont like putting the commands in the command line.

What do you mean by "commands"?

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

No branches or pull requests

2 participants