Skip to content

Commit 070a256

Browse files
committed
ST6RI-836 Changed name of %repo magic implementation to "Repo".
- Also added %repo to SysMLInteractive main program, and properly updated counter.
1 parent 6498b07 commit 070a256

File tree

4 files changed

+17
-6
lines changed

4 files changed

+17
-6
lines changed

org.omg.sysml.interactive/src/org/omg/sysml/interactive/SysMLInteractive.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,8 @@ public String help(String command) {
279279
help(command, Collections.emptyList());
280280
}
281281

282-
public String apiBasePath(String apiBasePath, List<String> help) {
282+
public String repo(String apiBasePath, List<String> help) {
283+
this.counter++;
283284
if (!help.isEmpty()) {
284285
return SysMLInteractiveHelp.getApiBasePathHelp();
285286
}
@@ -288,9 +289,15 @@ public String apiBasePath(String apiBasePath, List<String> help) {
288289
setApiBasePath(apiBasePath);
289290
}
290291

291-
return getApiBasePath();
292+
return getApiBasePath() + "\n";
292293
}
293294

295+
public String repo(String command) {
296+
return "-h".equals(command)?
297+
repo(null, Collections.singletonList("true")):
298+
repo(command, Collections.emptyList());
299+
}
300+
294301
public String eval(String input, String targetName, List<String> help) {
295302
if (Strings.isNullOrEmpty(input)) {
296303
this.counter++;
@@ -783,6 +790,8 @@ public void run() {
783790
}
784791
} else if ("%projects".equals(command)) {
785792
System.out.print(this.projects(argument));
793+
} else if ("%repo".equals(command)) {
794+
System.out.print(this.repo(argument));
786795
} else if ("%publish".equals(command)) {
787796
if (!"".equals(argument)) {
788797
System.out.print(this.publish(argument));

org.omg.sysml.jupyter.kernel/src/main/java/org/omg/sysml/jupyter/kernel/SysMLKernel.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public SysMLKernel() {
8282
this.magics.registerMagics(Export.class);
8383
this.magics.registerMagics(Projects.class);
8484
this.magics.registerMagics(Load.class);
85-
this.magics.registerMagics(ApiBasePath.class);
85+
this.magics.registerMagics(Repo.class);
8686

8787
this.magicParser = new MyMagicParser();
8888
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,21 @@
3131
import io.github.spencerpark.jupyter.kernel.magic.registry.LineMagic;
3232
import io.github.spencerpark.jupyter.kernel.magic.registry.MagicsArgs;
3333

34-
public class ApiBasePath {
34+
public class Repo {
3535

3636
private static final MagicsArgs REPO_ARGS = MagicsArgs.builder().onlyKnownKeywords().onlyKnownFlags()
3737
.optional("basePath")
3838
.flag("help", 'h', "true")
3939
.build();
4040

4141
@LineMagic("repo")
42-
public static String apiBasePath(List<String> args) {
42+
public static String repo(List<String> args) {
4343
Map<String, List<String>> vals = REPO_ARGS.parse(args);
4444
List<String> basePaths = vals.get("basePath");
4545
List<String> help = vals.get("help");
4646
String basePath = basePaths.isEmpty()? null: basePaths.get(0);
4747

4848
SysMLInteractive interactive = ISysML.getKernelInstance().getInteractive();
49-
return interactive.apiBasePath(basePath, help);
49+
return interactive.repo(basePath, help);
5050
}
5151
}

org.omg.sysml.jupyter.kernel/src/main/java/org/omg/sysml/jupyter/kernel/magic/View.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ public static DisplayData view(List<String> args) {
6363
break;
6464
case TEXT:
6565
dd.putText(vr.getText());
66+
default:
67+
break;
6668
}
6769
return dd;
6870
}

0 commit comments

Comments
 (0)