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.

Question: best practice for duplicated options

See original GitHub issue

For example, now, I’m implementing Key command with Cocona. In detail, the command will have subcommands which handle key store, like list, import, at the key store placed. And the key store’s path should be set manually. As code…

class KeyCommand
{
  public void List([Option]string? keyStorePath = null) { ... }
  public void Import([Option]string? keyStorePath = null) { ... }
}

But the keyStorePath option is duplicated though the option will be used over all subcommands in KeyStore class. So I imagine some codes to remove the code duplication…

class KeyCommand
{
  private readonly string _keyStorePath;
  
  public KeyCommand([Option]string? keyStorePath = null) { _keyStorePath = keyStorePath ?? /**/; }
  public void List() { ... }
  public void Import() { ... }
}

Can you let me know the solution if it can be achieved with Cocona or considering it together through this issue?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
mayukicommented, Aug 5, 2021

Version 1.6 has now been released. Please try it out.

1reaction
mayukicommented, Aug 3, 2021

Sorry for the delay, but I have started to implement this feature/enhancement. 🙂 I am considering throwing a runtime error if the signature conflicts.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Closing questions as exact duplications: 'best practice' - TeX
One of the concepts behind the StackExchange model is that questions which have the same underlying basis can be treated as duplicates, so...
Read more >
Why are some questions marked as duplicate? - Help Center
The fundamental goal of closing duplicate questions is to help people find the right answer by getting all of those answers in one...
Read more >
Tips for Handling Duplicate Cases in Survey Data
Identifying duplicates · Go to the Variables and Questions tab. · Change the Question Type for the variable IID – Interviewer Identification to ......
Read more >
What is best practice for resolving duplicate ci's...
I usually delete the CI and map the records to the right CI. Another option is to add a state Duplicate on the...
Read more >
Handling Duplicate Questions
Cut-and-paste duplicate questions. These questions are the very definition of exact duplicates; they are typically from users who willfully take ...
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