Skip to content

Commit cdf8249

Browse files
committed
fix: cleanup intelliji recommendations and move parameters at top
1 parent 7ecd0fa commit cdf8249

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

cli/src/main/java/dev/starfix/Starfix.java

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@
3232
@CommandLine.Command(mixinStandardHelpOptions = true)
3333
public class Starfix implements Runnable{
3434

35+
@Parameters(arity = "0..1")
36+
String uri;
37+
3538
@Command
3639
public int config() throws Exception {
3740
editConfig();
@@ -77,7 +80,6 @@ public int cloneCmd(@Parameters(index = "0") String url) {
7780

7881
} catch (Exception e) {
7982
e.printStackTrace();
80-
8183
}
8284

8385
try {
@@ -118,8 +120,7 @@ public int cloneCmd(@Parameters(index = "0") String url) {
118120
return ExitCode.OK;
119121
}
120122

121-
@Parameters(arity = "0..1")
122-
String uri;
123+
123124

124125
@Override
125126
public void run() {
@@ -134,7 +135,7 @@ public void run() {
134135
// Function to validate URL using with Regex
135136
public static boolean validate_url(String url) {
136137
// URL Validation to check a valid git repository
137-
String pattern = "((git|ssh|http(s)?)|(git@[\\w\\.]+))(:(//)?)([\\w\\.@\\:/\\-~]+)(.*)?";
138+
String pattern = "((git|ssh|http(s)?)|(git@[\\w.]+))(:(//)?)([\\w.@:/\\-~]+)(.*)?";
138139
return Pattern.matches(pattern,url);
139140
}
140141

@@ -146,16 +147,14 @@ public static boolean isBlob(String url){
146147

147148
// Function yo determine if the current OS is Windows
148149
public static boolean isWindows() {
149-
return System.getProperty("os.name").toLowerCase().indexOf("windows") >= 0;
150+
return System.getProperty("os.name").toLowerCase().contains("windows");
150151
}
151152

152153
// Function to fetch config file
153154
public static File getConfigFile() {
154155
String userHome = System.getProperty("user.home"); // Get User Home Directory: /home/user_name
155156

156-
File configFile = new File(userHome + "/.config/starfix.yaml"); // Loading YAML
157-
158-
return configFile;
157+
return new File(userHome + "/.config/starfix.yaml");
159158

160159
}
161160

@@ -186,7 +185,7 @@ public static void editConfig() throws Exception {
186185
// user------------------------------
187186

188187
int id = 0;
189-
while (id != 1 || id != 2 || id != 3) {
188+
while (true) {
190189
System.out.println(
191190
"\n--------Chose the preferred IDE --------\n 1.for vscode \n 2.for eclipse \n 3.for IntelliJ_IDEA ");
192191

@@ -319,4 +318,7 @@ public static void launch_editor(Path directory, String ide, String path, String
319318
runCommand(directory.getParent(),ide,path,filePath);// Launching the editor now
320319
}
321320
}
321+
322+
323+
322324
}

0 commit comments

Comments
 (0)