question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for obsolete arguments

See original GitHub issue

To phase out the non-GNU parameter style of Paket we need to mark certain argument styles as obsolete.

Let’s take paket add for example.

  • The current style is this: paket add nuget foo group Main version 1.0 --force
  • We would like to support this: paket add foo --group Main --version 1.0 --force

While we want to support the new style in the next major Paket version the old syntax should still be supported (for tooling like Ionide). Additionally, the old style should not be printed in the --help text. If someone uses the old style a warning should be issued to stderr (during parsing).

It seems we would require a new attribute (or attribute flag of CustomCommandLineAttribute?) to mark certain argument styles obsolete.

Currently, even before the GNU-style conversion, there are some arguments that are marked as obsolete in the help text, so I think it would be beneficial to have something like this.

I tried compiling Argu with VS 2017 but it failed with Argu.fsproj : error MSB4057: The target "Build" does not exist in the project..

// @forki

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
eiriktsarpaliscommented, Jun 14, 2017

As it stands, the implementation admits no distinction between the different names of an argument, other than their ordering. We would have to rework the internals so that additional metadata is associated with each individual name. As mentioned earlier, the requirement that obsolete arguments be hidden from the usage string or emit a warning in stderr seems arbitrary: other users may have different expectations of obsolescence. I think this is really an issue of introducing a third layer of configurability, at the argument name level, where things like usage string visibility or error messaging can be tweaked.

My impression is that all that engineering can be avoided by resorting to duplication of arguments like so:

type Args =
    | Group of id:string
    | [<Hidden; CustomCommandLine("group")>] Group_Legacy of id:string

let gpLegacy = parseResults.TryGetResult <@ Group_Legacy @>
let gpNew  = parseResults.TryGetResult <@ Group @>
match gpLegacy, gpNew with
| Some id, _ ->
     warnObsolete "group" 
     processGroup id
| None, Some new -> 
     processGroup id
| _ -> ()

I also think that an obsolete attribute on the union case level would be easier to achieve, assuming we agree what obsolete means in this context.

0reactions
agrosscommented, Jun 15, 2017

Excellent, I think I have a working solution. Please let me know what you think about the code and the output!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Obsolete functions, parameters, and values
The following functions, parameters, and values are obsolete. ... and more details about deprecated and removed/obsoleted features.
Read more >
How can I mark a specific parameter as obsolete ...
Short answer: You will need to create a new nethod with the new signature, and mark the current as obsolete. Longer answer.
Read more >
Argument Support Handout | Howe Center for Writing ...
Strong and thorough evidence supports an argument or “claim,” providing explanation in the form of quotes, statistics, personal reflections, ...
Read more >
ObsoleteAttribute Class (System)
ObsoleteAttribute is applicable to all program elements except assemblies, modules, parameters, and return values. Marking an element as obsolete informs ...
Read more >
Obsolete Macros - Autoconf
If there are three or four arguments, the modern version is used. · If the second argument appears to be a C or...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found