-
Notifications
You must be signed in to change notification settings - Fork 628
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Put CLI v1 code back into original command classes
Signed-off-by: Ben Sherman <[email protected]>
- Loading branch information
1 parent
fcbddf5
commit fc54c4e
Showing
71 changed files
with
1,360 additions
and
1,777 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ import nextflow.util.HistoryFile | |
import static nextflow.util.HistoryFile.Record | ||
|
||
/** | ||
* Common cache operations shared by {@link LogImpl} and {@link CleanImpl} | ||
* Common cache operations shared by {@link CmdLog} and {@link CmdClean} | ||
* | ||
* @author Paolo Di Tommaso <[email protected]> | ||
*/ | ||
|
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 |
---|---|---|
|
@@ -14,7 +14,7 @@ | |
* limitations under the License. | ||
*/ | ||
|
||
package nextflow.cli.v1 | ||
package nextflow.cli | ||
|
||
import com.beust.jcommander.Parameter | ||
import groovy.transform.CompileStatic | ||
|
@@ -25,7 +25,7 @@ import groovy.transform.CompileStatic | |
* @author Paolo Di Tommaso <[email protected]> | ||
*/ | ||
@CompileStatic | ||
abstract class AbstractCmd implements Runnable { | ||
abstract class CmdBase implements Runnable { | ||
|
||
private Launcher launcher | ||
|
||
|
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 |
---|---|---|
|
@@ -15,7 +15,6 @@ | |
*/ | ||
|
||
package nextflow.cli | ||
|
||
import java.nio.file.FileVisitResult | ||
import java.nio.file.FileVisitor | ||
import java.nio.file.Files | ||
|
@@ -24,6 +23,8 @@ import java.nio.file.Path | |
import java.nio.file.Paths | ||
import java.nio.file.attribute.BasicFileAttributes | ||
|
||
import com.beust.jcommander.Parameter | ||
import com.beust.jcommander.Parameters | ||
import com.google.common.hash.HashCode | ||
import groovy.transform.CompileStatic | ||
import groovy.util.logging.Slf4j | ||
|
@@ -39,14 +40,14 @@ import nextflow.trace.TraceRecord | |
import nextflow.util.HistoryFile.Record | ||
|
||
/** | ||
* CLI `clean` sub-command | ||
* Implements cache clean up command | ||
* | ||
* @author Paolo Di Tommaso <[email protected]> | ||
* @author Lorenz Gerber <[email protected]> | ||
*/ | ||
@Slf4j | ||
@CompileStatic | ||
class CleanImpl implements CacheBase { | ||
class CmdClean implements CacheBase { | ||
|
||
interface Options { | ||
String getAfter() | ||
|
@@ -61,14 +62,56 @@ class CleanImpl implements CacheBase { | |
ILauncherOptions getLauncherOptions() | ||
} | ||
|
||
@Parameters(commandDescription = 'Clean up project cache and work directories') | ||
static class V1 extends CmdBase implements Options { | ||
|
||
@Parameter(names=['-q', '-quiet'], description = 'Do not print names of files removed', arity = 0) | ||
boolean quiet | ||
|
||
@Parameter(names=['-f', '-force'], description = 'Force clean command', arity = 0) | ||
boolean force | ||
|
||
@Parameter(names=['-n', '-dry-run'], description = 'Print names of file to be removed without deleting them' , arity = 0) | ||
boolean dryRun | ||
|
||
@Parameter(names='-after', description = 'Clean up runs executed after the specified one') | ||
String after | ||
|
||
@Parameter(names='-before', description = 'Clean up runs executed before the specified one') | ||
String before | ||
|
||
@Parameter(names='-but', description = 'Clean up all runs except the specified one') | ||
String but | ||
|
||
@Parameter(names=['-k', '-keep-logs'], description = 'Removes only temporary files but retains execution log entries and metadata') | ||
boolean keepLogs | ||
|
||
@Parameter | ||
List<String> args | ||
|
||
@Override | ||
ILauncherOptions getLauncherOptions() { | ||
launcher.options | ||
} | ||
|
||
@Override | ||
String getName() { 'clean' } | ||
|
||
@Override | ||
void run() { | ||
new CmdClean(this).run() | ||
} | ||
|
||
} | ||
|
||
@Delegate | ||
private Options options | ||
|
||
private CacheDB currentCacheDb | ||
|
||
private Map<HashCode, Short> dryHash = new HashMap<>() | ||
|
||
CleanImpl(Options options) { | ||
CmdClean(Options options) { | ||
this.options = options | ||
} | ||
|
||
|
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 |
---|---|---|
|
@@ -15,21 +15,21 @@ | |
*/ | ||
|
||
package nextflow.cli | ||
|
||
import com.beust.jcommander.Parameter | ||
import com.beust.jcommander.Parameters | ||
import groovy.transform.CompileStatic | ||
import groovy.util.logging.Slf4j | ||
import nextflow.exception.AbortOperationException | ||
import nextflow.plugin.Plugins | ||
import nextflow.scm.AssetManager | ||
|
||
/** | ||
* CLI `clone` sub-command | ||
* CLI sub-command clone | ||
* | ||
* @author Paolo Di Tommaso <[email protected]> | ||
*/ | ||
@Slf4j | ||
@CompileStatic | ||
class CloneImpl { | ||
class CmdClone { | ||
|
||
interface Options extends IHubOptions { | ||
String getPipeline() | ||
|
@@ -38,10 +38,39 @@ class CloneImpl { | |
String getRevision() | ||
} | ||
|
||
@Parameters(commandDescription = 'Clone a project into a folder') | ||
static class V1 extends CmdBase implements Options, HubOptions { | ||
|
||
@Parameter(required=true, description = 'name of the project to clone') | ||
List<String> args | ||
|
||
@Parameter(names='-r', description = 'Revision to clone - It can be a git branch, tag or revision number') | ||
String revision | ||
|
||
@Parameter(names=['-d','-deep'], description = 'Create a shallow clone of the specified depth') | ||
Integer deep | ||
|
||
@Override | ||
String getPipeline() { args[0] } | ||
|
||
@Override | ||
String getTargetName() { | ||
args.size() > 1 ? args[1] : null | ||
} | ||
|
||
@Override | ||
String getName() { 'clone' } | ||
|
||
@Override | ||
void run() { | ||
new CmdClone(this).run() | ||
} | ||
} | ||
|
||
@Delegate | ||
private Options options | ||
|
||
CloneImpl(Options options) { | ||
CmdClone(Options options) { | ||
this.options = options | ||
} | ||
|
||
|
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 |
---|---|---|
|
@@ -19,6 +19,8 @@ package nextflow.cli | |
import java.nio.file.Path | ||
import java.nio.file.Paths | ||
|
||
import com.beust.jcommander.Parameter | ||
import com.beust.jcommander.Parameters | ||
import groovy.transform.CompileStatic | ||
import groovy.transform.PackageScope | ||
import groovy.util.logging.Slf4j | ||
|
@@ -27,15 +29,14 @@ import nextflow.exception.AbortOperationException | |
import nextflow.plugin.Plugins | ||
import nextflow.scm.AssetManager | ||
import nextflow.util.ConfigHelper | ||
|
||
/** | ||
* CLI `config` sub-command | ||
* Prints the pipeline configuration | ||
* | ||
* @author Paolo Di Tommaso <[email protected]> | ||
*/ | ||
@Slf4j | ||
@CompileStatic | ||
class ConfigImpl { | ||
class CmdConfig { | ||
|
||
interface Options { | ||
String getPipeline() | ||
|
@@ -48,17 +49,58 @@ class ConfigImpl { | |
ILauncherOptions getLauncherOptions() | ||
} | ||
|
||
@Parameters(commandDescription = 'Print a project configuration') | ||
static class V1 extends CmdBase implements Options { | ||
|
||
@Parameter(description = 'project name') | ||
List<String> args = [] | ||
|
||
@Parameter(names=['-a','-show-profiles'], description = 'Show all configuration profiles') | ||
boolean showAllProfiles | ||
|
||
@Parameter(names=['-profile'], description = 'Choose a configuration profile') | ||
String profile | ||
|
||
@Parameter(names = '-properties', description = 'Prints config using Java properties notation') | ||
boolean printProperties | ||
|
||
@Parameter(names = '-flat', description = 'Print config using flat notation') | ||
boolean printFlatten | ||
|
||
@Parameter(names = '-sort', description = 'Sort config attributes') | ||
boolean sort | ||
|
||
@Override | ||
String getPipeline() { | ||
args.size() > 0 ? args[0] : null | ||
} | ||
|
||
@Override | ||
ILauncherOptions getLauncherOptions() { | ||
launcher.options | ||
} | ||
|
||
@Override | ||
String getName() { 'config' } | ||
|
||
@Override | ||
void run() { | ||
new CmdConfig(this).run() | ||
} | ||
|
||
} | ||
|
||
private OutputStream stdout = System.out | ||
|
||
@Delegate | ||
private Options options | ||
|
||
ConfigImpl(Options options) { | ||
CmdConfig(Options options) { | ||
this.options = options | ||
} | ||
|
||
/* For testing purposes only */ | ||
ConfigImpl() {} | ||
CmdConfig() {} | ||
|
||
void run() { | ||
Plugins.init() | ||
|
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 |
---|---|---|
|
@@ -16,26 +16,48 @@ | |
|
||
package nextflow.cli | ||
|
||
import com.beust.jcommander.Parameter | ||
import com.beust.jcommander.Parameters | ||
import groovy.transform.CompileStatic | ||
import nextflow.plugin.Plugins | ||
import nextflow.ui.console.ConsoleExtension | ||
|
||
/** | ||
* CLI `console` sub-command | ||
* Launch the Nextflow Console plugin | ||
* | ||
* @author Paolo Di Tommaso <[email protected]> | ||
*/ | ||
@CompileStatic | ||
class ConsoleImpl { | ||
class CmdConsole { | ||
|
||
interface Options { | ||
String getScript() | ||
} | ||
|
||
@Parameters(commandDescription = 'Launch Nextflow interactive console') | ||
static class V1 extends CmdBase implements Options { | ||
|
||
@Parameter(description = 'Nextflow console arguments') | ||
List<String> args | ||
|
||
@Override | ||
String getScript() { | ||
args.size() > 0 ? args[0] : null | ||
} | ||
|
||
@Override | ||
String getName() { 'console' } | ||
|
||
@Override | ||
void run() { | ||
new CmdConsole(this).run() | ||
} | ||
} | ||
|
||
@Delegate | ||
private Options options | ||
|
||
ConsoleImpl(Options options) { | ||
CmdConsole(Options options) { | ||
this.options = options | ||
} | ||
|
||
|
Oops, something went wrong.