Skip to content

Commit

Permalink
Merge branch 'main' into feature/devonfw#103-implement-version-securi…
Browse files Browse the repository at this point in the history
…ty-checks

# Conflicts:
#	cli/src/main/java/com/devonfw/tools/ide/tool/LocalToolCommandlet.java
#	cli/src/main/java/com/devonfw/tools/ide/tool/ToolCommandlet.java
#	cli/src/main/java/com/devonfw/tools/ide/url/updater/UpdateManager.java
#	documentation/LICENSE.asciidoc
  • Loading branch information
jan-vcapgemini committed Feb 19, 2024
2 parents 20fecc3 + fb0ed7e commit 47ae5b7
Show file tree
Hide file tree
Showing 112 changed files with 2,810 additions and 330 deletions.
12 changes: 12 additions & 0 deletions cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
<releaseName>${project.artifactId}-${os.detected.classifier}-${os.detected.arch}</releaseName>
<java.version>17</java.version>
<native.maven.plugin.version>0.9.28</native.maven.plugin.version>
<jline.version>3.24.1</jline.version>
<jansi.version>2.4.0</jansi.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -75,6 +77,16 @@
<artifactId>progressbar</artifactId>
<version>0.10.0</version>
</dependency>
<dependency>
<groupId>org.jline</groupId>
<artifactId>jline</artifactId>
<version>${jline.version}</version>
</dependency>
<dependency>
<groupId>org.fusesource.jansi</groupId>
<artifactId>jansi</artifactId>
<version>${jansi.version}</version>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
import java.util.Map;
import java.util.Objects;

import com.devonfw.tools.ide.completion.CompletionCandidateCollector;
import com.devonfw.tools.ide.context.IdeContext;
import com.devonfw.tools.ide.property.KeywordProperty;
import com.devonfw.tools.ide.property.Property;
import com.devonfw.tools.ide.tool.ToolCommandlet;
import com.devonfw.tools.ide.version.VersionIdentifier;

/**
Expand Down Expand Up @@ -208,12 +208,11 @@ public String toString() {
}

/**
* @param version the {@link VersionIdentifier} to complete.
* @param collector the {@link CompletionCandidateCollector}.
* @return {@code true} on success, {@code false} otherwise.
* @return the {@link ToolCommandlet} set in a {@link Property} of this commandlet used for auto-completion of a
* {@link VersionIdentifier} or {@code null} if not exists or not configured.
*/
public boolean completeVersion(VersionIdentifier version, CompletionCandidateCollector collector) {
public ToolCommandlet getToolForVersionCompletion() {

return false;
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,16 @@
import com.devonfw.tools.ide.context.IdeContext;
import com.devonfw.tools.ide.property.KeywordProperty;
import com.devonfw.tools.ide.property.Property;
import com.devonfw.tools.ide.tool.aws.Aws;
import com.devonfw.tools.ide.tool.az.Azure;
import com.devonfw.tools.ide.tool.cobigen.Cobigen;
import com.devonfw.tools.ide.tool.eclipse.Eclipse;
import com.devonfw.tools.ide.tool.gcviewer.GcViewer;
import com.devonfw.tools.ide.tool.gh.Gh;
import com.devonfw.tools.ide.tool.gradle.Gradle;
import com.devonfw.tools.ide.tool.helm.Helm;
import com.devonfw.tools.ide.tool.java.Java;
import com.devonfw.tools.ide.tool.jmc.Jmc;
import com.devonfw.tools.ide.tool.kotlinc.Kotlinc;
import com.devonfw.tools.ide.tool.kotlinc.KotlincNative;
import com.devonfw.tools.ide.tool.mvn.Mvn;
Expand Down Expand Up @@ -52,16 +56,21 @@ public CommandletManagerImpl(IdeContext context) {
add(new HelpCommandlet(context));
add(new EnvironmentCommandlet(context));
add(new CompleteCommandlet(context));
add(new ShellCommandlet(context));
add(new InstallCommandlet(context));
add(new VersionSetCommandlet(context));
add(new VersionGetCommandlet(context));
add(new VersionListCommandlet(context));
add(new EditionGetCommandlet(context));
add(new EditionSetCommandlet(context));
add(new EditionListCommandlet(context));
add(new VersionCommandlet(context));
add(new Gh(context));
add(new Helm(context));
add(new Java(context));
add(new Node(context));
add(new Mvn(context));
add(new GcViewer(context));
add(new Gradle(context));
add(new Eclipse(context));
add(new Terraform(context));
Expand All @@ -71,6 +80,9 @@ public CommandletManagerImpl(IdeContext context) {
add(new KotlincNative(context));
add(new Vscode(context));
add(new Azure(context));
add(new Aws(context));
add(new Cobigen(context));
add(new Jmc(context));
}

private void add(Commandlet commandlet) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.devonfw.tools.ide.commandlet;

import java.util.Collections;
import java.util.List;

import com.devonfw.tools.ide.cli.CliArguments;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package com.devonfw.tools.ide.commandlet;

import com.devonfw.tools.ide.context.IdeContext;
import com.devonfw.tools.ide.property.ToolProperty;
import com.devonfw.tools.ide.tool.ToolCommandlet;
import com.devonfw.tools.ide.version.VersionIdentifier;

/**
* An internal {@link Commandlet} to get the installed edition for a tool.
*
* @see ToolCommandlet#getInstalledEdition()
*/
public class EditionGetCommandlet extends Commandlet {

/** The tool to get the edition of. */
public final ToolProperty tool;

/**
* The constructor.
*
* @param context the {@link IdeContext}.
*/
public EditionGetCommandlet(IdeContext context) {

super(context);
addKeyword(getName());
this.tool = add(new ToolProperty("", true, "tool"));
}

@Override
public String getName() {

return "get-edition";
}

@Override
public void run() {

ToolCommandlet commandlet = this.tool.getValue();
VersionIdentifier installedVersion = commandlet.getInstalledVersion();
if (installedVersion == null) {
this.context.info("The configured edition for tool {} is {}", commandlet.getName(), commandlet.getEdition());
this.context.info("To install that edition call the following command:");
this.context.info("ide install {}", commandlet.getName());
return;
}
String installedEdition = commandlet.getInstalledEdition();
this.context.info(installedEdition);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package com.devonfw.tools.ide.commandlet;

import com.devonfw.tools.ide.context.IdeContext;
import com.devonfw.tools.ide.property.ToolProperty;
import com.devonfw.tools.ide.tool.ToolCommandlet;

/**
* An internal {@link Commandlet} to list editions for a tool.
*
* @see ToolCommandlet#listEditions()
*/
public class EditionListCommandlet extends Commandlet {

/** The tool to list the editions of. */
public final ToolProperty tool;

/**
* The constructor.
*
* @param context the {@link IdeContext}.
*/
public EditionListCommandlet(IdeContext context) {

super(context);
addKeyword(getName());
this.tool = add(new ToolProperty("", true, "tool"));
}

@Override
public String getName() {

return "list-editions";
}

@Override
public void run() {

ToolCommandlet commandlet = this.tool.getValue();
commandlet.listEditions();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package com.devonfw.tools.ide.commandlet;

import com.devonfw.tools.ide.context.IdeContext;
import com.devonfw.tools.ide.property.EditionProperty;
import com.devonfw.tools.ide.property.ToolProperty;
import com.devonfw.tools.ide.tool.ToolCommandlet;

/**
* An internal {@link Commandlet} to set a tool edition.
*/
public class EditionSetCommandlet extends Commandlet {

/** The tool to set the edition of. */
public final ToolProperty tool;

/** The edition to set. */
public final EditionProperty edition;

/**
* The constructor.
*
* @param context the {@link IdeContext}.
*/
public EditionSetCommandlet(IdeContext context) {

super(context);
addKeyword(getName());
this.tool = add(new ToolProperty("", true, "tool"));
this.edition = add(new EditionProperty("", true, "edition"));
}

@Override
public String getName() {

return "set-edition";
}

@Override
public void run() {

ToolCommandlet commandlet = this.tool.getValue();
String edition = this.edition.getValue();

commandlet.setEdition(edition);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,9 @@ public void run() {
commandlet.install(false);
}

@Override
public ToolCommandlet getToolForVersionCompletion() {

return this.tool.getValue();
}
}

0 comments on commit 47ae5b7

Please sign in to comment.