Skip to content

Commit b48154e

Browse files
committed
Remove - from params
1 parent 179f108 commit b48154e

File tree

2 files changed

+38
-38
lines changed

2 files changed

+38
-38
lines changed

src/main/java/com/browserstack/local/Local.java

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,19 @@ public class Local {
2222

2323
public Local() {
2424
parameters = new HashMap<String, String>();
25-
parameters.put("-v", "-vvv");
26-
parameters.put("-f", "-f");
27-
parameters.put("-force", "-force");
28-
parameters.put("-only", "-only");
29-
parameters.put("-forcelocal", "-forcelocal");
30-
parameters.put("-localIdentifier", "-localIdentifier");
31-
parameters.put("-onlyAutomate", "-onlyAutomate");
32-
parameters.put("-proxyHost", "-proxyHost");
33-
parameters.put("-proxyPort", "-proxyPort");
34-
parameters.put("-proxyUser", "-proxyUser");
35-
parameters.put("-proxyPass", "-proxyPass");
36-
parameters.put("-forceproxy", "-forceproxy");
37-
parameters.put("-hosts", "-hosts");
25+
parameters.put("v", "-vvv");
26+
parameters.put("f", "-f");
27+
parameters.put("force", "-force");
28+
parameters.put("only", "-only");
29+
parameters.put("forcelocal", "-forcelocal");
30+
parameters.put("localIdentifier", "-localIdentifier");
31+
parameters.put("onlyAutomate", "-onlyAutomate");
32+
parameters.put("proxyHost", "-proxyHost");
33+
parameters.put("proxyPort", "-proxyPort");
34+
parameters.put("proxyUser", "-proxyUser");
35+
parameters.put("proxyPass", "-proxyPass");
36+
parameters.put("forceproxy", "-forceproxy");
37+
parameters.put("hosts", "-hosts");
3838
}
3939

4040
/**
@@ -46,19 +46,19 @@ public Local() {
4646
public void start(Map<String, String> options) throws Exception {
4747
command = new ArrayList<String>();
4848

49-
if (options.get("-binarypath") != null) {
50-
command.add(options.get("-binarypath"));
49+
if (options.get("binarypath") != null) {
50+
command.add(options.get("binarypath"));
5151
} else {
5252
LocalBinary lb = new LocalBinary();
5353
command.add(lb.getBinaryPath());
5454
}
5555

56-
String logFilePath = options.get("-logfile") == null ?
56+
String logFilePath = options.get("logfile") == null ?
5757
(System.getProperty("user.dir") + "/local.log") : options.get("logfile");
5858
command.add("-logFile");
5959
command.add(logFilePath);
6060

61-
command.add(options.get("-key"));
61+
command.add(options.get("key"));
6262
makeCommand(options);
6363

6464
if (options.get("onlyCommand") != null) return;
@@ -131,15 +131,15 @@ public boolean isRunning() {
131131
*/
132132
private void makeCommand(Map<String, String> options) {
133133
for (Map.Entry<String, String> opt : options.entrySet()) {
134-
List<String> ignoreKeys = Arrays.asList("-key", "-logfile", "-binarypath");
134+
List<String> ignoreKeys = Arrays.asList("key", "logfile", "binarypath");
135135
String parameter = opt.getKey().trim();
136136
if (ignoreKeys.contains(parameter)) {
137137
continue;
138138
}
139139
if (parameters.get(parameter) != null) {
140140
command.add(parameters.get(parameter));
141141
} else {
142-
command.add(parameter);
142+
command.add("-" + parameter);
143143
}
144144
if (opt.getValue() != null) {
145145
command.add(opt.getValue().trim());

src/test/java/com/browserstack/local/BrowserStackLocalTest.java

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public class BrowserStackLocalTest {
1818
public void setUp() throws Exception {
1919
l = new Local();
2020
options = new HashMap<String, String>();
21-
options.put("-key", System.getenv("BROWSERSTACK_ACCESS_KEY"));
21+
options.put("key", System.getenv("BROWSERSTACK_ACCESS_KEY"));
2222
}
2323

2424
@Test
@@ -42,15 +42,15 @@ public void testMultipleBinary() throws Exception {
4242

4343
@Test
4444
public void testEnableVerbose() throws Exception {
45-
options.put("-v", "");
45+
options.put("v", "true");
4646
options.put("onlyCommand", "true");
4747
l.start(options);
4848
assertTrue(l.command.contains("-vvv"));
4949
}
5050

5151
@Test
5252
public void testSetFolder() throws Exception {
53-
options.put("-f", "/var/html");
53+
options.put("f", "/var/html");
5454
options.put("onlyCommand", "true");
5555
l.start(options);
5656
assertTrue(l.command.contains("-f"));
@@ -59,47 +59,47 @@ public void testSetFolder() throws Exception {
5959

6060
@Test
6161
public void testEnableForce() throws Exception {
62-
options.put("-force", "");
62+
options.put("force", "true");
6363
options.put("onlyCommand", "true");
6464
l.start(options);
6565
assertTrue(l.command.contains("-force"));
6666
}
6767

6868
@Test
6969
public void testEnableOnly() throws Exception {
70-
options.put("-only", "");
70+
options.put("only", "true");
7171
options.put("onlyCommand", "true");
7272
l.start(options);
7373
assertTrue(l.command.contains("-only"));
7474
}
7575

7676
@Test
7777
public void testEnableOnlyAutomate() throws Exception {
78-
options.put("-onlyAutomate", "");
78+
options.put("onlyAutomate", "true");
7979
options.put("onlyCommand", "true");
8080
l.start(options);
8181
assertTrue(l.command.contains("-onlyAutomate"));
8282
}
8383

8484
@Test
8585
public void testEnableForceLocal() throws Exception {
86-
options.put("-forcelocal", "");
86+
options.put("forcelocal", "true");
8787
options.put("onlyCommand", "true");
8888
l.start(options);
8989
assertTrue(l.command.contains("-forcelocal"));
9090
}
9191

9292
@Test
9393
public void testEnableForceProxy() throws Exception {
94-
options.put("-forceproxy", "");
94+
options.put("forceproxy", "true");
9595
options.put("onlyCommand", "true");
9696
l.start(options);
9797
assertTrue(l.command.contains("-forceproxy"));
9898
}
9999

100100
@Test
101101
public void testSetLocalIdentifier() throws Exception {
102-
options.put("-localIdentifier", "abcdef");
102+
options.put("localIdentifier", "abcdef");
103103
options.put("onlyCommand", "true");
104104
l.start(options);
105105
assertTrue(l.command.contains("-localIdentifier"));
@@ -108,10 +108,10 @@ public void testSetLocalIdentifier() throws Exception {
108108

109109
@Test
110110
public void testSetProxy() throws Exception {
111-
options.put("-proxyHost", "localhost");
112-
options.put("-proxyPort", "8080");
113-
options.put("-proxyUser", "user");
114-
options.put("-proxyPass", "pass");
111+
options.put("proxyHost", "localhost");
112+
options.put("proxyPort", "8080");
113+
options.put("proxyUser", "user");
114+
options.put("proxyPass", "pass");
115115
options.put("onlyCommand", "true");
116116
l.start(options);
117117
assertTrue(l.command.contains("-proxyHost"));
@@ -126,16 +126,16 @@ public void testSetProxy() throws Exception {
126126

127127
@Test
128128
public void testSetHosts() throws Exception {
129-
options.put("-hosts", "localhost,8000,0");
129+
options.put("hosts", "localhost,8000,0");
130130
options.put("onlyCommand", "true");
131131
l.start(options);
132132
assertTrue(l.command.contains("localhost,8000,0"));
133133
}
134134

135135
@Test
136136
public void testCustomArguments() throws Exception {
137-
options.put("-customKey", "customValue");
138-
options.put("-customKey2", "customValue2");
137+
options.put("customKey", "customValue");
138+
options.put("customKey2", "customValue2");
139139
options.put("onlyCommand", "true");
140140
l.start(options);
141141
assertTrue(l.command.contains("-customKey"));
@@ -147,11 +147,11 @@ public void testCustomArguments() throws Exception {
147147

148148
@Test
149149
public void testCustomBoolArguments() throws Exception {
150-
options.put("-customKey", "");
151-
options.put("-customKey2", "");
150+
options.put("customKey1", "true");
151+
options.put("customKey2", "true");
152152
options.put("onlyCommand", "true");
153153
l.start(options);
154-
assertTrue(l.command.contains("-customKey"));
154+
assertTrue(l.command.contains("-customKey1"));
155155
assertTrue(l.command.contains("-customKey2"));
156156
}
157157

0 commit comments

Comments
 (0)