Skip to content

Commit 7ee1375

Browse files
authored
Merge pull request #670 from Systems-Modeling/ST6RI-865
ST6RI-865 Update repository save utilities
2 parents db5ecc5 + 4b700f4 commit 7ee1375

2 files changed

Lines changed: 16 additions & 11 deletions

File tree

org.omg.kerml.xtext/src/org/omg/kerml/xtext/util/KerMLRepositorySaveUtil.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*****************************************************************************
22
* SysML 2 Pilot Implementation
3-
* Copyright (c) 2019-2022 Model Driven Solutions, Inc.
3+
* Copyright (c) 2019-2022, 2025 Model Driven Solutions, Inc.
44
* Copyright (c) 2021 Twingineer LLC
55
*
66
* This program is free software: you can redistribute it and/or modify
@@ -27,7 +27,6 @@
2727

2828
import java.nio.file.Paths;
2929
import java.util.Arrays;
30-
import java.util.Date;
3130

3231
import org.apache.commons.cli.CommandLine;
3332
import org.apache.commons.cli.CommandLineParser;
@@ -49,8 +48,8 @@ public class KerMLRepositorySaveUtil extends KerMLTraversalUtil {
4948

5049
public static final String BASE_PATH_OPTION_LONG_NAME = "base-path-url";
5150
public static final String LIBRARY_OPTION_LONG_NAME = "library-base-path";
52-
public static final String BRANCH_OPTION = "Project branch to use. If none given the default branch of the project is used";
53-
public static final String PROJECT_NAME_OPTION_DESCRIPTION = "project name to upload the model into. If not specified a unique name is generated based on the selected folders and the current timestamp";
51+
public static final String BRANCH_OPTION = "gives the project branch to use (if none is given, the default branch of the project is used)";
52+
public static final String PROJECT_NAME_OPTION_DESCRIPTION = "gives the name of the project to upload the model into (if none is given, the last segment of the input path is used)";
5453
public static final String DERIVED_OPTION_DESCRIPTION = "specifies that derived attributes should be included (the default is not to)";
5554
public static final String IMPLICIT_GEN_OPTION_DESCRIPTION = "specifies that implicit generalizations should be generated (the default is not to)";
5655
public static final String VERBOSE_MODE_OPTION_DESCRIPTION = "verbose mode";
@@ -196,7 +195,7 @@ protected String[] processArgs(String[] args) {
196195
/**
197196
* Initialize the traversal with an ApiElementProcessingFacade to write to a new repository Project.
198197
* Set the project name as the file name from the first argument after any options, stripped
199-
* of its extension, with the current date/time appended.
198+
* of its extension.
200199
*
201200
* @param args the command line arguments after processing, with options removed
202201
*/
@@ -208,11 +207,10 @@ protected void initialize(String[] args) {
208207

209208
if (this.projectName == null) {
210209
this.projectName = Paths.get(args[0]).getFileName().toString();
211-
int j = this.projectName.indexOf('.');
212-
if (j >= 0) {
210+
int j = this.projectName.lastIndexOf('.');
211+
if (j > 0) {
213212
this.projectName = this.projectName.substring(0, j);
214213
}
215-
this.projectName += " " + new Date();
216214
}
217215

218216
ApiElementProcessingFacade processingFacade = new ApiElementProcessingFacade(this.projectName, branchName, this.getBasePath());
@@ -269,7 +267,8 @@ public void run(String[] args) {
269267
*
270268
* <p>Usage:
271269
*
272-
* <p>KerMLRepositorySaveUtil [-b base-path-url] [-l library-base-path] [-d] [-g] [-v] input-path [library-path library-path...]
270+
* <p>KerMLRepositorySaveUtil [-b base-path-url] [-l library-base-path] [-d] [-g] [-v] [-p project-name]
271+
* [--branch branch-name] input-path [library-path library-path...]
273272
*
274273
* <p>where:
275274
*
@@ -279,6 +278,8 @@ public void run(String[] args) {
279278
* <li>-d specifies that derived attributes should be included (the default is not to)</li>
280279
* <li>-g specifies that implicit elements should be generated (the default is not to)</li>
281280
* <li>-v specifies verbose mode (the default is non-verbose)</li>
281+
* <li>-p project-name gives the name of the project to upload the model into (if none given, the last segment of the input path is used)</li>
282+
* <li>--branch branch-name gives the project branch to use (if none given, the default branch of the project is used)</li>
282283
* <li>input-path is a path for reading input resources</li>
283284
* <li>library-paths are paths for reading library resources, relative to the library-base-path (if one is given)</li>
284285
* </ul>

org.omg.sysml.xtext/src/org/omg/sysml/xtext/util/SysMLRepositorySaveUtil.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,19 @@ public SysMLRepositorySaveUtil() {
4141
*
4242
* <p>Usage:
4343
*
44-
* <p>SysMLRepositorySaveUtil [-b base-path-url] [-l library-base-path] [-d] [-g] [-v] input-path [library-path library-path...]
44+
* <p>SysMLRepositorySaveUtil [-b base-path-url] [-l library-base-path] [-d] [-g] [-v] [-p project-name]
45+
* [--branch branch-name] input-path [library-path library-path...]
4546
*
4647
* <p>where:
4748
*
4849
* <ul>
4950
* <li>-b base-path-url gives the URL for the base path to be used for the API endpoint (if none is given, the default is used)</li>
5051
* <li>-l library-base-path gives the base path to used for reading model library resources</li>
5152
* <li>-d specifies that derived attributes should be included (the default is not to)</li>
52-
* <li>-g specifies that implicit generalizations should be generated (the default is not to)</li>
53+
* <li>-g specifies that implicit elements should be generated (the default is not to)</li>
54+
* <li>-v specifies verbose mode (the default is non-verbose)</li>
55+
* <li>-p project-name gives the name of the project to upload the model into (if none given, the last segment of the input path is used)</li>
56+
* <li>--branch branch-name gives the project branch to use (if none given, the default branch of the project is used)</li>
5357
* <li>input-path is a path for reading input resources</li>
5458
* <li>library-paths are paths for reading library resources, relative to the library-base-path (if one is given)</li>
5559
* </ul>

0 commit comments

Comments
 (0)