Opened 5 years ago

Closed 4 years ago

#1926 closed feature request (done)

Add support for command line arguments

Reported by: jkarder Owned by: mkommend
Priority: low Milestone: HeuristicLab 3.3.8
Component: PluginInfrastructure Version: 3.3.8
Keywords: Cc:

Description

There should be a way to pass and handle command line arguments in HeuristicLab, e.g. an argument like /start:Optimizer could automatically start the Optimizer.

Attachments (1)

CommandLineArgumentHandlingRegistryEntries.reg (908 bytes) - added by jkarder 4 years ago.

Download all attachments as: .zip

Change History (36)

comment:1 Changed 5 years ago by jkarder

  • Status changed from new to accepted

comment:2 Changed 5 years ago by jkarder

r8563:

  • created argument handling infrastructure
  • added StartArgument

comment:3 Changed 5 years ago by jkarder

It is now possible to automatically start applications using the StartArgument. The syntax is as follows:

  • /start:ApplicationName

Examples:

  • /start:Optimizer
  • /start:"Persistence Configuration"

comment:4 Changed 5 years ago by jkarder

  • Owner changed from jkarder to ascheibe
  • Status changed from accepted to reviewing

comment:5 follow-up: Changed 5 years ago by gkronber

We have a very old ticket for this #45 (which I have just closed as duplicate).

comment:6 in reply to: ↑ 5 Changed 5 years ago by jkarder

Replying to gkronber:

We have a very old ticket for this #45 (which I have just closed as duplicate).

Oh, I missed that one. Thanks!

comment:7 Changed 5 years ago by ascheibe

  • Owner changed from ascheibe to jkarder
  • Status changed from reviewing to assigned

Thanks very much for implementing this, here are my reviewing comments:

  • The white space in the regex should be replaced with \s
  • GetArguments in the ArgumentHandling class should throw an exception if the argument is not valid or null so that the user gets notified if there is a problem with the argument
  • The StartToken string should be moved to the StartArgument class so that everything concerning this argument is in one place
  • Maybe this Token string should also be in the interface as all arguments will need one
  • Please remove the public StarterForm(string appName) method from the StarterForm class as it is not used anywhere

comment:8 Changed 5 years ago by jkarder

r8677: refactored argument handling infrastructure based on the changes suggested by ascheibe in comment:7:ticket:1926

comment:9 Changed 5 years ago by jkarder

Thanks for the review.

comment:10 Changed 5 years ago by jkarder

  • Owner changed from jkarder to ascheibe
  • Status changed from assigned to reviewing

comment:11 Changed 5 years ago by ascheibe

  • Owner changed from ascheibe to jkarder
  • Status changed from reviewing to readytorelease

Thanks, looks good!

comment:12 Changed 4 years ago by ascheibe

  • Owner changed from jkarder to mkommend
  • Status changed from readytorelease to reviewing

I'm reassigning this ticket to mkommend as he also wanted to have a look at it.

comment:13 Changed 4 years ago by abeham

I wondered if we could have a way to hide the starter. Can you omit showing the starter if the /start command is given? I think we don't really need to show it in this case.

comment:14 Changed 4 years ago by mkommend

  • Owner changed from mkommend to jkarder
  • Status changed from reviewing to assigned

Reviewing comments:

  • Argument.GetHashCode() is strangely implemented. Normally it should reflect the implementation of Equals.
  • A better name for the folder containing the files would be CommandLineArguments or CommandLineArgumentHandling. ArgumentHandling is little bit too generic IMHO.
  • Why was it decided to implement command line parsing manually and not use existing libraries, that provide more functionality? (e.g., http://stackoverflow.com/questions/491595/best-way-to-parse-command-line-arguments-in-c)
  • Please address the comment by abeham.

comment:15 Changed 4 years ago by jkarder

r8748:

comment:16 Changed 4 years ago by jkarder

  • Status changed from assigned to accepted

comment:17 Changed 4 years ago by jkarder

Thanks for the detailed review. It is now possible to hide the starter by using the HideStarterArgument (/hideStarter).

comment:18 Changed 4 years ago by jkarder

  • Owner changed from jkarder to mkommend
  • Status changed from accepted to reviewing

comment:19 Changed 4 years ago by jkarder

  • Owner changed from mkommend to jkarder
  • Status changed from reviewing to assigned

comment:20 Changed 4 years ago by jkarder

  • Status changed from assigned to accepted

comment:21 Changed 4 years ago by jkarder

r8749: made generic type parameter in ICommandLineArgument<T> invariant

comment:22 Changed 4 years ago by jkarder

  • Owner changed from jkarder to mkommend
  • Status changed from accepted to reviewing

comment:23 Changed 4 years ago by jkarder

  • Owner changed from mkommend to jkarder
  • Status changed from reviewing to assigned

comment:24 Changed 4 years ago by jkarder

  • Status changed from assigned to accepted

comment:25 follow-up: Changed 4 years ago by jkarder

r8818:

  • added OpenArgument
  • refactored argument handling infrastructure

comment:26 Changed 4 years ago by jkarder

All valid command line arguments are now passed to any started application through the PluginManager and the ApplicationManager to enable specific handling. As a result it is now possible to load saved HeuristicLab files via command line arguments. A new instance of the Optimizer will be started automatically and the files will be opened. I also attached the registry entries needed to associate HeuristicLab files with HeuristicLab. Keep in mind that you probably have to change the specified path to the HeuristicLab executable.

comment:27 Changed 4 years ago by ascheibe

r8819 updated slave app to work with the changes of r8818

comment:28 Changed 4 years ago by jkarder

r8820: updated DataImporter and MetaOptimization branches to work with the changes of r8818

comment:29 in reply to: ↑ 25 ; follow-up: Changed 4 years ago by mkommend

Replying to jkarder:

r8818:

  • added OpenArgument
  • refactored argument handling infrastructure

In r8818 you introduced a command line property in the IMainForm interface, which should be removed as it is not needed and and command line arguments should not be handled be a form object.

comment:30 Changed 4 years ago by jkarder

r8821: reverted the changes addressed by mkommend in comment:29:ticket:1926

comment:31 in reply to: ↑ 29 Changed 4 years ago by jkarder

Replying to mkommend:

Replying to jkarder:

r8818:

  • added OpenArgument
  • refactored argument handling infrastructure

In r8818 you introduced a command line property in the IMainForm interface, which should be removed as it is not needed and and command line arguments should not be handled be a form object.

Thanks for the hint.

comment:32 Changed 4 years ago by jkarder

r8934: refactored arguments

comment:33 Changed 4 years ago by jkarder

  • Owner changed from jkarder to mkommend
  • Status changed from accepted to reviewing

comment:34 Changed 4 years ago by mkommend

  • Status changed from reviewing to readytorelease

Thx for implementing this feature. I have no further reviewing comments.

comment:35 Changed 4 years ago by swagner

  • Resolution set to done
  • Status changed from readytorelease to closed
  • Version changed from 3.3.7 to 3.3.8
Note: See TracTickets for help on using tickets.