-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
lenz
committed
Jan 1, 2019
1 parent
dd35ec8
commit 469f029
Showing
15 changed files
with
186 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{:server-type [:cloud :or :not] | ||
:region "<your AWS Region>" ;; e.g. us-east-1 | ||
;; :creds-profile "<AWS Profile Name>" ;; Optional | ||
:proxy-port "<local-port>"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"firstName": "John", | ||
"lastName": "Smith", | ||
"isAlive": true, | ||
"age": 27, | ||
"address": { | ||
"streetAddress": "21 2nd Street", | ||
"city": "New York", | ||
"state": "NY", | ||
"postalCode": "10021-3100" | ||
}, | ||
"phoneNumbers": [ | ||
{ | ||
"type": "home", | ||
"number": "212 555-1234" | ||
}, | ||
{ | ||
"type": "office", | ||
"number": "646 555-4567" | ||
}, | ||
{ | ||
"type": "mobile", | ||
"number": "123 456-7890" | ||
} | ||
], | ||
"children": [], | ||
"spouse": null | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
The limerick packs laughs anatomical | ||
Into space that is quite economical. | ||
But the good ones I've seen | ||
So seldom are clean | ||
And the clean ones so seldom are comical. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/usr/bin/env bash | ||
"exec" "plk" "-Sdeps" "{:deps {cli-matic {:mvn/version \"0.3.2\"}}}" "-Ksf" "$0" "$@" | ||
|
||
(ns exit-code | ||
(:require [cli-matic.core :refer [run-cmd]])) | ||
|
||
;; To run this, try from the project root: | ||
;; | ||
;; $ ./exit-status.cljs exit --mode NONE | ||
;; echo $? | ||
;; 0 | ||
;; $ ./exit-status.cljs exit --mode ONE | ||
;; $ echo $? | ||
;; 1 | ||
;; $ ./exit-status.cljs exit --mode XXX | ||
;; ** ERROR: ** | ||
;; JVM Exception: #object[Error Error: No matching clause: XXX] | ||
;; $ echo $? | ||
;; 255 | ||
|
||
|
||
(defn exiter | ||
"Just exits with an exit code. | ||
Unknown values cause an exception." | ||
[{:keys [mode]}] | ||
(condp = mode | ||
"NONE" nil | ||
"ONE" 1 | ||
)) | ||
|
||
|
||
(def CONFIGURATION | ||
{:app {:command "exit-code" | ||
:description "Return the exit code" | ||
:version "0.0.1"} | ||
:global-opts [] | ||
:commands [{:command "exit" :short "x" | ||
:description ["Forces an exit code."] | ||
:opts [{:option "mode" :as "NONE|ONE|ERROR" :type :string :default :present}] | ||
:runs exiter} | ||
]}) | ||
|
||
(defn -main | ||
[& args] | ||
(run-cmd args CONFIGURATION)) | ||
|
||
(set! *main-cli-fn* -main) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/usr/bin/env bash | ||
"exec" "plk" "-Sdeps" "{:deps {cli-matic {:mvn/version \"0.3.2\"}}}" "-Ksf" "$0" "$@" | ||
|
||
(ns read-file | ||
(:require [cli-matic.core :refer [run-cmd]])) | ||
|
||
;; To run this, try from the project root: | ||
;; | ||
;; ./read-file.cljs p --text data/multiline-text.txt --lines data/multiline-text.txt --json data/json-example.json --edn data/edn-example.edn | ||
;; | ||
;; You can also use URLs: | ||
;; | ||
;; ./read-file.cljs p --json https://jsonplaceholder.typicode.com/todos/1 | ||
|
||
(defn printer | ||
"Just prints read values." | ||
[{:keys [text json edn lines]}] | ||
(prn {:text text | ||
:lines lines | ||
:json json | ||
:edn edn})) | ||
|
||
|
||
(def CONFIGURATION | ||
{:app {:command "read-file" | ||
:description "Reads all parameters as files." | ||
:version "0.0.1"} | ||
:global-opts [] | ||
:commands [{:command "printer" :short "p" | ||
:description ["Prints parameters. All files can be local or http/https"] | ||
:opts [{:option "text" :as "A text file as single string" :type :slurp} | ||
{:option "lines" :as "A text file as lines" :type :slurplines} | ||
{:option "json" :as "A JSON file" :type :jsonfile} | ||
{:option "edn" :as "An EDN file" :type :ednfile}] | ||
:runs printer} | ||
]}) | ||
|
||
(defn -main | ||
[& args] | ||
(run-cmd args CONFIGURATION)) | ||
|
||
(set! *main-cli-fn* -main) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters