Skip to content

Commit 8675d6b

Browse files
committed
Replace GoBack action on splash screen with Continue
1 parent b8321c1 commit 8675d6b

8 files changed

+37
-3
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
[![GitHub last commit][last_commit_badge]][last_commit_link]
55
[![CI status][ci_status_badge]][ci_status_link]
66

7+
![CLI usage example](assets/roc.png)
8+
79
Roc-start is a CLI tool for generating application headers for a new roc application.
810

911
Starting a new roc app which requires multiple packages can be a bit cumbersome, due to the requirement for long urls which cannot be easily memorized. This typically requires opening previous projects which have some of the same dependencies, and copy/pasting from there, or visiting multiple github pages, finding the release page, and copying the url of the required assets.

assets/roc.png

609 KB
Loading

main.roc

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
app [main!] {
2+
cli: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br",
3+
}
4+
5+
import cli.Stdout
6+
import cli.Dir
7+
import cli.Path
8+
9+
main! = |_args|
10+
when Dir.list!("./src/") is
11+
Ok(files) ->
12+
List.for_each_try!(
13+
files,
14+
|file|
15+
path_str = Path.display(file) |> Str.drop_prefix("./src/")
16+
if Str.ends_with(path_str, ".roc") then
17+
Stdout.line!(path_str)
18+
else
19+
Ok({}),
20+
)
21+
22+
_ -> Err(Exit(1, "Failed to list files"))

src/tui/Controller.roc

+1-1
Original file line numberDiff line numberDiff line change
@@ -305,5 +305,5 @@ choose_flags_handler = |model, action|
305305
splash_handler : Model, UserAction -> [Step Model, Done Model]
306306
splash_handler = |model, action|
307307
when action is
308-
GoBack -> Step(ST.to_main_menu_state(model))
308+
Continue -> Step(ST.to_main_menu_state(model))
309309
_ -> Step(model)

src/tui/InputHandlers.roc

+7
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ action_to_input_handler = |action|
4040
TextSubmit -> handle_text_submit
4141
SetFlags -> handle_set_flags
4242
Secret -> handle_secret
43+
Continue -> handle_continue
4344
_ -> unhandled
4445

4546
handle_cancel : Model, Input -> Result UserAction [Unhandled]
@@ -168,6 +169,12 @@ handle_secret = |_model, input|
168169
Symbol(GraveAccent) -> Ok(Secret)
169170
_ -> Err(Unhandled)
170171

172+
handle_continue : Model, Input -> Result UserAction [Unhandled]
173+
handle_continue = |_model, input|
174+
when input is
175+
Action(Enter) -> Ok(Continue)
176+
_ -> Err(Unhandled)
177+
171178
unhandled : Model, Input -> Result UserAction [Unhandled]
172179
unhandled = |_model, _input|
173180
Err(Unhandled)

src/tui/Model.roc

+1-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ import ansi.ANSI
3232
import repos.Manager as RM exposing [RepositoryRelease]
3333
import rtils.Compare
3434

35-
3635
Model : {
3736
screen : ANSI.ScreenSize,
3837
cursor : ANSI.CursorPosition,
@@ -117,7 +116,7 @@ get_actions = |model|
117116
[Exit, SearchGo, Cancel, TextInput(None)]
118117
|> with_go_back_or_backspace(model)
119118

120-
Splash(_) -> [Exit, GoBack]
119+
Splash(_) -> [Exit, Continue]
121120
_ -> [Exit]
122121

123122
with_search_or_clear_filter = |actions, model| List.append(actions, (if Model.menu_is_filtered(model) then ClearFilter else Search))

src/tui/UserAction.roc

+1
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,6 @@ UserAction : [
2323
TextSubmit,
2424
SetFlags,
2525
Secret,
26+
Continue,
2627
None,
2728
]

src/tui/View.roc

+3
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ control_prompts_dict =
5050
|> Dict.insert(Cancel, "ESC : CANCEL")
5151
|> Dict.insert(Finish, "ENTER : FINISH")
5252
|> Dict.insert(SetFlags, "F : FLAGS")
53+
|> Dict.insert(Continue, "ENTER : CONTINUE")
5354
|> Dict.insert(PrevPage, "< PREV")
5455
|> Dict.insert(NextPage, "> NEXT")
5556

@@ -68,6 +69,7 @@ control_prompts_trunc_dict =
6869
|> Dict.insert(Cancel, "ESC : CNCL")
6970
|> Dict.insert(Finish, "ENTER : GO")
7071
|> Dict.insert(SetFlags, "F : FLGS")
72+
|> Dict.insert(Continue, "ENTER : CNT")
7173
|> Dict.insert(PrevPage, "<")
7274
|> Dict.insert(NextPage, ">")
7375

@@ -87,6 +89,7 @@ control_prompts_short_dict =
8789
|> Dict.insert(Cancel, "ESC")
8890
|> Dict.insert(Finish, "ENTER")
8991
|> Dict.insert(SetFlags, "F")
92+
|> Dict.insert(Continue, "ENTER")
9093
|> Dict.insert(PrevPage, "<")
9194
|> Dict.insert(NextPage, ">")
9295

0 commit comments

Comments
 (0)