|
20 | 20 | state (api.state/get-state module-name)
|
21 | 21 |
|
22 | 22 | service-name
|
23 |
| - (-> (prompt/select "Select Service" |
24 |
| - (->> (get-in module [:network :services]) |
25 |
| - (map (fn [[service-name]] |
26 |
| - {:value (name service-name) |
27 |
| - :label (name service-name)})))) |
28 |
| - keyword) |
| 23 | + (or (-> props :service keyword) |
| 24 | + (-> (prompt/select "Select Service" |
| 25 | + (->> (get-in module [:network :services]) |
| 26 | + (map (fn [[service-name]] |
| 27 | + {:value (name service-name) |
| 28 | + :label (name service-name)})))) |
| 29 | + keyword)) |
29 | 30 |
|
30 | 31 | _ (when-not service-name (cli.utils/exit! "No service selected" 1))
|
31 | 32 | _ (log/info (str "Using @|bold " (name service-name) "|@"))
|
32 | 33 |
|
33 | 34 | service (get-in module [:network :services service-name])
|
34 | 35 |
|
35 | 36 | endpoint-name
|
36 |
| - (-> (prompt/select "Select Default Endpoint" |
37 |
| - (->> (:endpoints service) |
38 |
| - (map (fn [[endpoint-name]] |
39 |
| - {:value (name endpoint-name) |
40 |
| - :label (name endpoint-name)})))) |
41 |
| - keyword) |
| 37 | + (or (-> props :endpoint :keyword) |
| 38 | + (-> (prompt/select "Select Default Endpoint" |
| 39 | + (->> (:endpoints service) |
| 40 | + (map (fn [[endpoint-name]] |
| 41 | + {:value (name endpoint-name) |
| 42 | + :label (name endpoint-name)})))) |
| 43 | + keyword)) |
42 | 44 |
|
43 | 45 | _ (when-not endpoint-name (cli.utils/exit! "No endpoint selected" 1))
|
44 | 46 | _ (log/info (str "Using @|bold " (name endpoint-name) "|@"))
|
|
85 | 87 |
|
86 | 88 | :opts [{:option "module"
|
87 | 89 | :short 0
|
| 90 | + :type :string} |
| 91 | + {:option "service" |
| 92 | + :short 1 |
| 93 | + :type :string} |
| 94 | + {:option "endpoint" |
| 95 | + :short 2 |
88 | 96 | :type :string}]
|
89 | 97 |
|
90 | 98 | :runs set-default-service-endpoint!}]})
|
0 commit comments