@@ -8,22 +8,35 @@ image:https://travis-ci.org/vamshikr/java-cli.svg?branch=master["Build Status",
88
99== Introduction
1010
11- The SWAMP Java CLI is a Java library and a command line interface that provides many common operation on a SWAMP instance. These operations include getting the list of projects, packages, versions of packages, assessments, tools and platforms. Creating packages, uploading new versions of a package, configuring and start an assessment, checking the status of an assessment, and downloading SCARF results.
11+ The SWAMP Java CLI is a _Java library_ and a _command line interface_ that provides many common operation on a SWAMP instance. These operations include getting the list of projects, packages, versions of packages, assessments, tools and platforms. Creating packages, uploading new versions of a package, configuring and start an assessment, checking the status of an assessment, and downloading SCARF results.
1212
1313== Installation and Network Settings
1414
15- From https://github.com/mirswamp/java-cli/releases page, download the latest java-cli-X.Y.Z-with-dependencies.jar archive, where X.Y.Z stands for the latest release version number.
15+ From https://github.com/mirswamp/java-cli/releases page, download the latest ` java-cli-X.Y.Z.zip` archive, where ` X.Y.Z` stands for the latest release version number.
1616
17- Pre-requisites for running the Java CLI is Java-7 or above. For the rest of this document we will use `java-cli-1.5.0-with-dependencies.jar` as the reference file.
17+ Extract/Unarchive the `java-cli-X.Y.Z.zip` file. This extracts all the files into `java-cli-X.Y.Z` directory. The executable files are in the `bin` directory and the main jar file is in the `lib`
18+ For rest of this document we will use `1.5.0` as the reference CLI version and _Linux_ as the reference OS.
1819
20+ [NOTE]
21+ Pre-requisites for running the Java CLI is Java-7 or above.
1922
20- To check if the `jar` file works run the following command on the terminal:
23+ On Posix compatible systems run the following command from the `java-cli-X.Y.Z` directory:
24+ ```
25+ ./bin/swamp
2126```
2227
23- java -jar java-cli-1.5.0-with-dependencies.jar
28+ On Windows systems run the following command from the ` java-cli-X.Y.Z` directory:
2429```
30+ .\bin\swamp.bat
31+ ```
32+
33+ Users can also run the `jar` file directory by running the following command from the `java-cli-X.Y.Z` directory:
34+ ```
35+ java -jar lib/java-cli-1.5.0-with-dependencies.jar
36+ ```
37+
2538
26- If the above command is successful, the program display `sub-commands` available:
39+ If any of the above command is successful, the program display `sub-commands` available:
2740```
2841------------------------------------------------------------------------
2942Usage: <program> <sub-command> <options>
@@ -82,19 +95,19 @@ In your environment, setup the environment variables `http_proxy` or `https_prox
8295.Example 1:
8396```
8497% export http_proxy=http://squid.cs.wisc.edu:3128
85- % java -jar target/java-cli-1.5.0-jar-with-dependencies.jar login --filepath ./scripts/resources/userinfo.properties
98+ % ./bin/swamp login --filepath ./scripts/resources/userinfo.properties
8699```
87100
88101.Example 2:
89102```
90103% export http_proxy=http://user1:password1@squid.cs.wisc.edu:3128
91- % java -jar target/java-cli-1.5.0-jar-with-dependencies.jar login --filepath ./scripts/resources/userinfo.properties
104+ % ./bin/swamp login --filepath ./scripts/resources/userinfo.properties
92105```
93106
94107.Example 3:
95108```
96109% export https_proxy=https://user1:password1@squid.cs.wisc.edu:3128
97- % java -jar target/java-cli-1.5.0-jar-with-dependencies.jar login --filepath ./scripts/resources/userinfo.properties
110+ % ./bin/swamp login --filepath ./scripts/resources/userinfo.properties
98111```
99112--
100113
@@ -110,12 +123,12 @@ Pass the following java properties to the java-cli's `login` sub-command:
110123--
111124.Example 1:
112125.................
113- % java - Dhttp.proxyHost=squid.cs.wisc.edu -Dhttp.proxyPort=3128 -jar target/java-cli-1.5.0-jar-with-dependencies.jar login --filepath ./scripts/resources/userinfo.properties
126+ % ./bin/swamp login --filepath ./scripts/resources/userinfo.properties - Dhttp.proxyHost=squid.cs.wisc.edu -Dhttp.proxyPort=3128
114127.................
115128
116129.Example 2:
117130.................
118- % java - Dhttp.proxyHost=squid.cs.wisc.edu -Dhttp.proxyPort=3128 -Dhttp.proxyUser=user1 -Dhttp.proxyPassword=password1 -jar target/java-cli-1.5.0-jar-with-dependencies.jar login --filepath ./scripts/resources/userinfo.properties
131+ % ./bin/swamp login --filepath ./scripts/resources/userinfo.properties - Dhttp.proxyHost=squid.cs.wisc.edu -Dhttp.proxyPort=3128 -Dhttp.proxyUser=user1 -Dhttp.proxyPassword=password1
119132.................
120133--
121134
@@ -130,12 +143,12 @@ Pass the following java properties to the java-cli's `login` sub-command:
130143--
131144.Example 1:
132145.................
133- % java - Dhttps.proxyHost=squid.cs.wisc.edu -Dhttps.proxyPort=3128 -jar target/java-cli-1.5.0-jar-with-dependencies.jar login --filepath ./scripts/resources/userinfo.properties
146+ % ./bin/swamp login --filepath ./scripts/resources/userinfo.properties - Dhttps.proxyHost=squid.cs.wisc.edu -Dhttps.proxyPort=3128
134147.................
135148
136149.Example 2:
137150.................
138- % java - Dhttps.proxyHost=squid.cs.wisc.edu -Dhttps.proxyPort=3128 -Dhttps.proxyUser=user1 -Dhttps.proxyPassword=password1 -jar target/java-cli-1.5.0-jar-with-dependencies.jar login --filepath ./scripts/resources/userinfo.properties
151+ % ./bin/swamp login --filepath ./scripts/resources/userinfo.properties - Dhttps.proxyHost=squid.cs.wisc.edu -Dhttps.proxyPort=3128 -Dhttps.proxyUser=user1 -Dhttps.proxyPassword=password1
139152.................
140153--
141154
@@ -158,7 +171,7 @@ SWAMP Java CLI provides *sub-commands* to perform various operations on SWAMP. A
158171| user | Information about the current user
159172|=======================================================================
160173
161- To get help on each of the sub-command in the above list run `java -jar java-cli-1.5.0-with-dependencies.jar <sub-command> --help` or `java -jar java-cli-1.5.0-with-dependencies.jar <sub-command> --H`.
174+ To get help on each of the sub-command in the above list run `./bin/swamp <sub-command> --help` or `./bin/swamp <sub-command> --H`.
162175
163176[[login]]
164177=== Login Sub-Command
@@ -252,7 +265,7 @@ The `packages` sub-command with `--upload` option supports the following additio
252265
253266Example:
254267```
255- java -jar java-cli-1.5.0-with-dependencies.jar package --upload --pkg-archive /home//swamp/api-dev/java-cli/scripts/resources/test_packages/railsgoat-9052b4fcf0/railsgoat-9052b4fcf0.zip -pkg-conf /home//swamp/api-dev/java-cli/scripts/resources/test_packages/railsgoat-9052b4fcf0/package.conf --os-deps 'ubuntu-16.04-64=libsqlite3-dev libmysqlclient-dev' --new-pkg
268+ ./bin/swamp package --upload --pkg-archive /home//swamp/api-dev/java-cli/scripts/resources/test_packages/railsgoat-9052b4fcf0/railsgoat-9052b4fcf0.zip -pkg-conf /home//swamp/api-dev/java-cli/scripts/resources/test_packages/railsgoat-9052b4fcf0/package.conf --os-deps 'ubuntu-16.04-64=libsqlite3-dev libmysqlclient-dev' --new-pkg
256269```
257270
258271If the above command is successful, the output will be:
@@ -267,7 +280,7 @@ To display the *types of software packages* supported by SWAMP, `--types` option
267280
268281Example:
269282```
270- java -jar java-cli-1.5.0-with-dependencies.jar package --types
283+ ./bin/swamp package --types
271284```
272285
273286Example output from the above command:
@@ -306,7 +319,7 @@ The package sub-command with the `--list` option accepts the following additiona
306319
307320Example:
308321```
309- java -jar java-cli-1.5.0-with-dependencies.jar packages --list --project MyProject
322+ ./bin/swamp packages --list --project MyProject
310323```
311324
312325Example output from the above command:
@@ -345,7 +358,7 @@ To *delete* one or more packages, use `--delete` option with the `package` sub-c
345358
346359Example:
347360```
348- % java -jar java-cli-1.5.0-with-dependencies.jar packages --delete -project MyProject --package webgoat-lessons
361+ % ./bin/swamp packages --delete -project MyProject --package webgoat-lessons
349362Deleted 'Name: webgoat-lessons, Version: 7.1'
350363```
351364
@@ -370,7 +383,7 @@ To get a list of all the `tools` that the user has access to in SWAMP, use `--li
370383
371384Example:
372385```
373- java -jar java-cli-1.5.0-with-dependencies.jar tools --list
386+ ./bin/swamp tools --list
374387```
375388
376389Example output of the above command:
@@ -411,7 +424,7 @@ To get a tool's UUID, use `--uuid` option with the `tools` sub-command.
411424
412425Example:
413426```
414- java -jar java-cli-1.5.0-with-dependencies.jar tools --uuid --name PMD
427+ ./bin/swamp tools --uuid --name PMD
415428```
416429
417430Example output of the above command:
@@ -449,7 +462,7 @@ The `assessments` sub-command with the `--run` option supports the following add
449462
450463Example:
451464```
452- java -jar java-cli-1.5.0-with-dependencies.jar assessments --run --package swamp-gradle-example --tool error-prone
465+ ./bin/swamp assessments --run --package swamp-gradle-example --tool error-prone
453466```
454467
455468Example output of the above command:
@@ -460,22 +473,22 @@ d14aa1f9-d0f1-48b6-adb4-088ac0e1ffee
460473
461474Example with a particular package version and tool version:
462475```
463- java -jar java-cli-1.5.0-with-dependencies.jar assessments --run --package swamp-gradle-example::1.0 --tool error-prone::1.1.1
476+ ./bin/swamp assessments --run --package swamp-gradle-example::1.0 --tool error-prone::1.1.1
464477```
465478
466479Example with a particular package version and tool version:
467480```
468- java -jar java-cli-1.5.0-with-dependencies.jar assessments --run --package swamp-gradle-example::1.0 --tool error-prone::1.1.1
481+ ./bin/swamp assessments --run --package swamp-gradle-example::1.0 --tool error-prone::1.1.1
469482```
470483
471484Example with a particular package version and multiple tools:
472485```
473- java -jar java-cli-1.5.0-with-dependencies.jar assessments --run --package swamp-gradle-example::1.0 --tool error-prone::1.1.1 spotbugs PMD
486+ ./bin/swamp assessments --run --package swamp-gradle-example::1.0 --tool error-prone::1.1.1 spotbugs PMD
474487```
475488
476489Example with a package, multiple tools, and multiple platforms:
477490```
478- java -jar java-cli-1.5.0-with-dependencies.jar assessments --run --package lighttpd --tool cppcheck "Clang Static Analyzer" --platform centos-7-64 debian-8-64 fedora-24-64 ubuntu-16.04-64
491+ ./bin/swamp assessments --run --package lighttpd --tool cppcheck "Clang Static Analyzer" --platform centos-7-64 debian-8-64 fedora-24-64 ubuntu-16.04-64
479492```
480493
481494
@@ -497,7 +510,7 @@ To *list* assessments created, use `--list` with the `assessments` sub-command.
497510
498511Example:
499512```
500- java -jar java-cli-1.5.0-with-dependencies.jar assessments -L --tool SpotBugs
513+ ./bin/swamp assessments -L --tool SpotBugs
501514```
502515
503516Example output for the above command
@@ -533,7 +546,7 @@ To *list* assessment runs, use `--list` with the `results` sub-command. The `res
533546
534547Example:
535548```
536- java -jar java-cli-1.5.0-with-dependencies.jar results --list
549+ ./bin/swamp results --list
537550```
538551
539552Example output for the above command:
@@ -586,12 +599,12 @@ SCARF results downloaded from the assessment run will be stored into `<SCARF_FIL
586599
587600.Example 1:
588601```
589- java -jar java-cli-1.5.0-with-dependencies.jar results --download --results-uuid f4856ee8-b402-11e7-92c3-001a4a814413 --filepath $PWD/scarf-results.xml
602+ ./bin/swamp results --download --results-uuid f4856ee8-b402-11e7-92c3-001a4a814413 --filepath $PWD/scarf-results.xml
590603```
591604
592605.Example 2:
593606```
594- java -jar java-cli-1.5.0-with-dependencies.jar results --download --package swamp-gradle-example::1.0 --tool SpotBugs::3.2.0 --platform ubuntu-16.04-64
607+ ./bin/swamp results --download --package swamp-gradle-example::1.0 --tool SpotBugs::3.2.0 --platform ubuntu-16.04-64
595608```
596609
597610=== Projects Sub-Command
@@ -616,7 +629,7 @@ The `projects` sub-command with `--list` option supports the following additiona
616629
617630Example:
618631```
619- java -jar java-cli-1.5.0-with-dependencies.jar projects --list
632+ ./bin/swamp projects --list
620633```
621634
622635Example for the output of the above command:
@@ -645,7 +658,7 @@ To get UUID of a project, use `--uuid` option with the `projects` sub-command.
645658
646659Example:
647660```
648- java -jar java-cli-1.5.0-with-dependencies.jar projects --uuid --name 4plugins
661+ ./bin/swamp projects --uuid --name 4plugins
649662```
650663
651664Example for the output of the above command:
@@ -675,7 +688,7 @@ The `platforms` sub-command with `--list` option supports the following addition
675688
676689Example:
677690```
678- java -jar java-cli-1.5.0-with-dependencies.jar platforms --list
691+ ./bin/swamp platforms --list
679692```
680693
681694Example for the output of the above command:
@@ -717,7 +730,7 @@ To get UUID of a platform, use `--uuid` option with the `platforms` sub-command.
717730
718731Example:
719732```
720- java -jar java-cli-1.5.0-with-dependencies.jar platforms --uuid --name ubuntu-16.04-64
733+ ./bin/swamp platforms --uuid --name ubuntu-16.04-64
721734```
722735
723736Example for the output of the above command:
@@ -743,7 +756,7 @@ The output of the above sub-command will display (SUCCESS|FAILURE|INPROGRESS). I
743756Example:
744757
745758```
746- java -jar java-cli-1.5.0-with-dependencies.jar status --assess-uuid 96e6e4e0-efce-4216-bff9-b20b30ca2e83 --project-uuid df2e7c15-4d28-4224-b25c-c2570bd91156
759+ ./bin/swamp status --assess-uuid 96e6e4e0-efce-4216-bff9-b20b30ca2e83 --project-uuid df2e7c15-4d28-4224-b25c-c2570bd91156
747760```
748761
749762Example output of the above command:
0 commit comments