the-carlisle-group / Acre-Desktop

A simple Dyalog APL IDE plugin that introduces "projects" and allows you to keep your source code in Unicode text files.
MIT License
11 stars 1 forks source link

Command Modifiers #85

Closed PaulMansour closed 6 years ago

PaulMansour commented 6 years ago

Let's assume we like command modifiers, which I think we will. Then we need only OpenProject. This totally sovles the naming problem. I think OpenProject is the best name if we can have just one name.

We need at least two modifiers. One to tell Acre to NOT load dependencies, and one to tell Acre to NOT monitor the code. Both of these are obviously stated in the negative. I think we want the default to be to open dependencies and to monitor the code.

If we use m and d, we get:

]OpenProject folder [ns] -m -d

so m means to NOT monitor and d means to NOT open dependencies, which is is a little counter intuitive.

Suggestions for better letters or names?

the dash does put one in the mind of negation, so maybe this is fine.

PaulMansour commented 6 years ago

A second issue is what to call the config parameter or parameters, and how to specify the options.

Would it be ok to dispense with Load and just use Open with modifiers" Like so:

:Namespace
        Open ← 'SubProj1 -m'  'SubProj2 -m'  'SubProj3' 
:EndNamespace

There is probably not much need for -d inside the config file, but I like the idea of only having open, and keeping the same syntax.

aplteam commented 6 years ago

A single character might not be the best.

What about -monitor ? (I would prefer -track anyway because that's that all the SMCs use: tracking changes).

-monitor could be defined as having the default 1. When used one must assign a value as in

-monitor=1
-monitor=0
-monitor='on'
-monitor='off'

That would get around that problem.

The same can be dome for dependencies which could be defined as -dep.

PaulMansour commented 6 years ago

That certainly gets around the problem, but I really like the terseness of a single letter. I'd rather not type:

dependencies=off

but I guess it is clear.

We could have single letters and force you to add "off":

-d=off -t=off //tracking is off -m=off //messages off

or allow single letters and the full word.

I'm ok with "Track" instead of monitor.

Are we likely to have many more modifiers? I guess we have messages=off. What else?

Paul

aplteam commented 6 years ago

Dyalog's user command framework allows you to use as few characters as needed to tell an option apart from any other option. So even if it is documented as -track the short version -t would do as long as there is no other flag or option that starts with a t.

At the moment I can only think of -verbose but experience tells that over time other ideas might pop up.

PhilLast commented 6 years ago

Assuming we're not going to want more than 26 options we only need to ensure they all start with a different letter to be as terse as we want. The definition requires defaults other than 0 to be specified as -option:default so -

-dependencies:"on"
-help:""
-messages:"on"
-track:"on"

leaves scope for some more "abc efg ijkl nopqrs uvwxyz"

Re. help. Following Norbert's complaint and suggestion the reasoning behind -help:"" is that we can then follow any acre command with -h=? or -h=?? &c. and the script can call it's own Help function with the tally of help's value. Or we could give it a numeric level or none at all and not discriminate between levels. Then we'd need only ]command -h.

The interface works well with good quote handling not preventing quoted hyphens in arguments if/where necessary. Only shortfall I've found is in quoted strings: one two"three four"five six parses as 'one' 'two' 'three four' 'five' 'six' in acre but 'one' 'two' 'three fourfive' 'six' in SALT.Parse

Not a big deal.

Ready to go with above if agreed.

aplteam commented 6 years ago

Supporting any flavour of -h comes with a problem: it requires you to know how to issue a valid call, and that's exactly what you want to have help with. To get around this you must at least continue to support the built-in syntax.

PhilLast commented 6 years ago

You have to know something to use it but it's not a lot to learn:

]command -h
]?command

and I couldn't disable ]?command if I wanted to.

As Kai pointed out above, within any particular command, modifiers can be abbreviated to the extent that they are unique. All the following starting with different letters makes them candidates for that one letter.

acre 4.2.0 will come with

-help ⍝ no value
-messages=on|off|#.global.name
-track=on|off
-dependencies=on|off

the first two (-h and -m=) are valid for any command. ]command -h initially will return only the one line description and the syntax with none of the additional stuff added by ]?command. The second two (-t= and -d=) are valid for only OpenProject but are currently ignored.

The ]command args [option←'value'] syntax is discarded.

PhilLast commented 6 years ago

Done