You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 commandsCOUNT 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.
The text was updated successfully, but these errors were encountered:
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.
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
;
. The current syntax uses&&
to achieve this, thus;
may be treated as a synonym.A; NFC file_name
,a && nfc file_name
anda ; nfC file_name
(although the last one will look weird) should perform the same task.sleep
, with syntaxsleep 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 theA
button, wait for 5 seconds, and then press theB
button.for COUNT ; commands ; done
will repeatcommands
COUNT
times. Example usage:for 10; a; sleep 1; b; sleep 1; done
, will causeA
,B
,A
,B
, and so on to be pressed, (ideally) 1 second apart.for 10; a; sleep 1; for 10; b; sleep 1; done; sleep 1; done
, or graphically:for COUNT DELAY; cmd1; cmd2; done
is the same asfor COUNT; cmd1; sleep DELAY; cmd2; sleep DELAY; done
.read file_path
, which parses a filefile_path
that looks like the code block above. Comments would start with#
's.macro mname; cmd1; cmd2; done
and using it likefor 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
joycontrol
must be able to still use it after the changes have been made. Nonetheless, the changes provided may introduce some bugs along the wayThe addition of
;
and#
as key symbols and setting all commands to case-insensitive may cause issues withfile_name
s. 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.The text was updated successfully, but these errors were encountered: