Skip to content

Commit

Permalink
Merge pull request #47 from imclerran/refactoring
Browse files Browse the repository at this point in the history
Refactoring
  • Loading branch information
imclerran authored Jun 21, 2024
2 parents 7460c8c + 25cf0dc commit 8712d31
Show file tree
Hide file tree
Showing 8 changed files with 839 additions and 732 deletions.
2 changes: 1 addition & 1 deletion ci/check-repo.roc
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ main =
repoRes = Decode.fromBytes bytes Rvn.pretty
when repoRes is
Ok _ -> Stdout.line! "$(greenFg)0$(resetStyle) errors decoding repo"
Err _ -> Task.err (Exit 1 "$(redFg)1$(resetStyle) error decoding repo")
Err _ -> Task.err (Exit 1 "$(redFg)1$(resetStyle) error decoding repo")
18 changes: 10 additions & 8 deletions src/ArgParser.roc
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@ parseOrDisplayMessage = \args -> Cli.parseOrDisplayMessage cliParser args

baseUsage = Help.usageHelp cliParser.config ["roc-start"] cliParser.textStyle

extendedUsage =
ansiCode = when cliParser.textStyle is
Color -> "\u(001b)[1m\u(001b)[4m"
Plain -> ""
extendedUsage =
ansiCode =
when cliParser.textStyle is
Color -> "\u(001b)[1m\u(001b)[4m"
Plain -> ""
usageHelpStr = Help.usageHelp cliParser.config ["roc-start"] cliParser.textStyle
extendedUsageStr = when
Help.helpText cliParser.config ["roc-start"] cliParser.textStyle
|> Str.splitFirst "$(ansiCode)Commands:"
extendedUsageStr =
when
Help.helpText cliParser.config ["roc-start"] cliParser.textStyle
|> Str.splitFirst "$(ansiCode)Commands:"
is
Ok { after } -> "$(ansiCode)Commands:$(after)"
Err NotFound -> ""
Expand All @@ -37,7 +39,7 @@ cliParser =
}
|> Cli.assertValid

appSubcommand =
appSubcommand =
Cli.weave {
appName: <- Param.str { name: "app-name", help: "Name your new roc app." },
platform: <- Param.str { name: "platform", help: "The platform to use." },
Expand Down
52 changes: 26 additions & 26 deletions src/AsciiArt.roc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module [Art, size, width, height, rocStart, rocSmall, rocLarge, rocStartColored,

import ansi.Core

Art : {
Art : {
height : I32,
width : I32,
art : List { text : Str, r : I32, c : I32, color : Core.Color },
Expand All @@ -21,12 +21,12 @@ width : List Str -> I32
width = \art -> List.first art |> Result.withDefault "" |> Str.countUtf8Bytes |> Num.toI32

rocStart = [
" _ _ ",
" _ __ ___ ___ ____| |_ __ _ _ __| |_ ",
"| '__/ _ \\ / __|____/ ___| __/ _` | '__| __|",
"| | | (_) | (_|_____\\___ \\ || (_| | | | |_ ",
"|_| \\___/ \\___| |____/\\__\\__,_|_| \\__|",
" quick start cli ",
" _ _ ",
" _ __ ___ ___ ____| |_ __ _ _ __| |_ ",
"| '__/ _ \\ / __|____/ ___| __/ _` | '__| __|",
"| | | (_) | (_|_____\\___ \\ || (_| | | | |_ ",
"|_| \\___/ \\___| |____/\\__\\__,_|_| \\__|",
" quick start cli ",
]

rocStartColored = {
Expand All @@ -48,25 +48,25 @@ rocStartColored = {
{ text: "\\___ \\ || (_| | | | |_", r: 3, c: 20, color: B8 93 },
{ text: "|_| \\___/ \\___|", r: 4, c: 0, color: B8 93 },
{ text: "|____/\\__\\__,_|_| \\__|", r: 4, c: 20, color: B8 93 },
]
],
}

rocSmall = [
"___ ",
"\\ ---___ ",
" \\ ---___ ",
" \\ |\\ ",
" \\ | \\ __-\\ ",
" \\ | \\--' /_\\ ",
" \\ | \\ / ",
" \\|---______\\ ",
" /| __/ ",
" | | __/ ",
" | |_/ ",
" / | ",
" | | ",
" | _/ ",
" |/ ",
"___ ",
"\\ ---___ ",
" \\ ---___ ",
" \\ |\\ ",
" \\ | \\ __-\\ ",
" \\ | \\--' /_\\ ",
" \\ | \\ / ",
" \\|---______\\ ",
" /| __/ ",
" | | __/ ",
" | |_/ ",
" / | ",
" | | ",
" | _/ ",
" |/ ",
]

rocSmallColored = {
Expand Down Expand Up @@ -100,8 +100,8 @@ rocSmallColored = {
{ text: "/ |", r: 11, c: 11, color: B8 93 },
{ text: "| |", r: 12, c: 10, color: B8 93 },
{ text: "| _/", r: 13, c: 10, color: B8 93 },
{ text: "|/", r: 14, c: 10, color: B8 93 },
]
{ text: "|/", r: 14, c: 10, color: B8 93 },
],
}

rocLarge = [
Expand Down Expand Up @@ -192,7 +192,7 @@ rocLargeColored = {
{ text: "....", r: 16, c: 36, color: B8 177 },
{ text: ":------------------------", r: 16, c: 40, color: B8 93 },
{ text: "............", r: 16, c: 65, color: B8 177 },
{ text: "-------", r: 16, c: 77, color: B8 93},
{ text: "-------", r: 16, c: 77, color: B8 93 },
{ text: "..", r: 17, c: 38, color: B8 177 },
{ text: ":--------------------------", r: 17, c: 40, color: B8 93 },
{ text: ".........", r: 17, c: 67, color: B8 177 },
Expand Down
Loading

0 comments on commit 8712d31

Please sign in to comment.