-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Standalone commands / CLI respect -h / --help for help (#307)
- Loading branch information
Showing
18 changed files
with
140 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
cineast-runtime/src/main/java/org/vitrivr/cineast/standalone/cli/AbstractCineastCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package org.vitrivr.cineast.standalone.cli; | ||
|
||
import com.github.rvesse.airline.HelpOption; | ||
import javax.inject.Inject; | ||
|
||
/** | ||
* The base command for al Cineast CLI commands. | ||
* | ||
* @author loris.sauter | ||
* @version 1.0 | ||
*/ | ||
public abstract class AbstractCineastCommand implements Runnable { | ||
|
||
/** | ||
* The help option available to derived classes. | ||
*/ | ||
@Inject | ||
protected HelpOption<Runnable> help; | ||
|
||
/** | ||
* The main method of all commands which will be executed by the CLI. | ||
*/ | ||
@Override | ||
public void run() { | ||
if (!help.showHelpIfRequested()) { | ||
this.execute(); | ||
} | ||
} | ||
|
||
/** | ||
* The actual command logic to be executed. | ||
*/ | ||
protected abstract void execute(); | ||
|
||
} |
6 changes: 5 additions & 1 deletion
6
cineast-runtime/src/main/java/org/vitrivr/cineast/standalone/cli/CineastCli.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,20 @@ | ||
package org.vitrivr.cineast.standalone.cli; | ||
|
||
import com.github.rvesse.airline.annotations.Cli; | ||
import com.github.rvesse.airline.annotations.Parser; | ||
import com.github.rvesse.airline.help.Help; | ||
import com.github.rvesse.airline.parser.errors.handlers.CollectAll; | ||
import org.vitrivr.cineast.standalone.cli.db.DropTableCommand; | ||
import org.vitrivr.cineast.standalone.cli.db.PolyphenyBenchmarkCommand; | ||
|
||
|
||
@Cli(name = "cineast-api", description = "The CLI provided by the Cineast API.", commands = { | ||
DropTableCommand.class, TagRetrievalCommand.class, OptimizeEntitiesCommand.class, | ||
CodebookCommand.class, DatabaseSetupCommand.class, ExtractionCommand.class, ImportCommand.class, | ||
ThreeDeeTestCommand.class, RetrieveCommand.class, Help.class, SingleObjRetrievalCommand.class, | ||
TextRetrievalCommand.class, DistinctColumnApiCommand.class, | ||
PolyphenyBenchmarkCommand.class}, defaultCommand = Help.class) | ||
PolyphenyBenchmarkCommand.class}, defaultCommand = Help.class, parserConfiguration = @Parser(errorHandler = CollectAll.class) | ||
) | ||
public class CineastCli { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.