Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
TanklesXL committed Mar 13, 2024
1 parent 6c51d74 commit 276eb32
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 29 deletions.
20 changes: 10 additions & 10 deletions src/glint.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -484,12 +484,12 @@ fn execute_root(
False ->
snag.error(
"unmatched named arguments: "
<> {
contents.named_args
|> list.drop(list.length(named))
|> list.map(fn(s) { "'" <> s <> "'" })
|> string.join(", ")
},
<> {
contents.named_args
|> list.drop(list.length(named))
|> list.map(fn(s) { "'" <> s <> "'" })
|> string.join(", ")
},
)
}
})
Expand All @@ -515,8 +515,8 @@ fn execute_root(
Error(#(snag, help)) ->
Error(
snag.pretty_print(snag)
<> "\nSee the following help text, available via the '--help' flag.\n\n"
<> help,
<> "\nSee the following help text, available via the '--help' flag.\n\n"
<> help,
)
}
}
Expand Down Expand Up @@ -708,8 +708,8 @@ fn build_subcommands_help(
Metadata(
name: name,
description: cmd.contents
|> option.map(fn(command) { command.description })
|> option.unwrap(""),
|> option.map(fn(command) { command.description })
|> option.unwrap(""),
),
..acc
]
Expand Down
12 changes: 6 additions & 6 deletions test/glint/flag_test.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ pub fn flag_default_test() {
let flag = #(
"flag",
flag.string()
|> flag.default("default"),
|> flag.default("default"),
)

glint.new()
Expand Down Expand Up @@ -315,7 +315,7 @@ pub fn global_flag_test() {
do: glint.flag(
"flag",
flag.float_list()
|> flag.default([1.0, 2.0]),
|> flag.default([1.0, 2.0]),
fn(_) { testcase([1.0, 2.0]) },
),
)
Expand All @@ -328,13 +328,13 @@ pub fn global_flag_test() {
[],
"flag",
flag.float_list()
|> flag.default([3.0, 4.0]),
|> flag.default([3.0, 4.0]),
)
|> glint.add(at: [], do: {
use _flag <- glint.flag(
"flag",
flag.float_list()
|> flag.default([1.0, 2.0]),
|> flag.default([1.0, 2.0]),
)

testcase([5.0, 6.0])
Expand Down Expand Up @@ -375,7 +375,7 @@ pub fn toggle_test() {
use flag <- glint.flag(
"flag",
flag.bool()
|> flag.default(True),
|> flag.default(True),
)
use _, _, flags <- glint.command()
flag(flags)
Expand All @@ -401,7 +401,7 @@ pub fn toggle_test() {
use flag <- glint.flag(
"flag",
flag.int()
|> flag.default(1),
|> flag.default(1),
)
use _, _, _ <- glint.command()
Nil
Expand Down
26 changes: 13 additions & 13 deletions test/glint_test.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -101,35 +101,35 @@ pub fn help_test() {
let global_flag = #(
"global",
flag.string()
|> flag.description("This is a global flag"),
|> flag.description("This is a global flag"),
)

let flag_1 = #(
"flag1",
flag.string()
|> flag.description("This is flag1"),
|> flag.description("This is flag1"),
)

let flag_2 = #(
"flag2",
flag.int()
|> flag.description("This is flag2"),
|> flag.description("This is flag2"),
)
let flag_3 = #(
"flag3",
flag.bool()
|> flag.description("This is flag3"),
|> flag.description("This is flag3"),
)
let flag_4 = #(
"flag4",
flag.float()
|> flag.description("This is flag4"),
|> flag.description("This is flag4"),
)

let flag_5 = #(
"flag5",
flag.float_list()
|> flag.description("This is flag5"),
|> flag.description("This is flag5"),
)

let cli =
Expand Down Expand Up @@ -297,8 +297,8 @@ pub fn global_and_group_flags_test() {
[],
"f",
flag.int()
|> flag.default(2)
|> flag.description("global flag example"),
|> flag.default(2)
|> flag.description("global flag example"),
)
|> glint.add(
[],
Expand All @@ -311,8 +311,8 @@ pub fn global_and_group_flags_test() {
use f <- glint.flag(
"f",
flag.bool()
|> flag.default(True)
|> flag.description("i decided to override the global flag"),
|> flag.default(True)
|> flag.description("i decided to override the global flag"),
)
use _, _, flags <- glint.command()
f(flags)
Expand All @@ -322,14 +322,14 @@ pub fn global_and_group_flags_test() {
["sub"],
"sub_group_flag",
flag.int()
|> flag.default(1),
|> flag.default(1),
)
|> glint.add(["sub", "sub"], {
use f <- glint.flag(
"f",
flag.bool()
|> flag.default(True)
|> flag.description("i decided to override the global flag"),
|> flag.default(True)
|> flag.description("i decided to override the global flag"),
)
use _, _, flags <- glint.command()
f(flags)
Expand Down

0 comments on commit 276eb32

Please sign in to comment.