Skip to content

Commit

Permalink
Fix warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
floitsch committed Oct 3, 2024
1 parent 93be90d commit 2d720f3
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: cli
description: Tools, like an argument parser, to create command-line applications.
environment:
sdk: ^2.0.0-alpha.144
sdk: ^2.0.0-alpha.161
dependencies:
fs:
url: github.com/toitlang/pkg-fs
Expand Down
1 change: 0 additions & 1 deletion src/cache.toit
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import host.file
import host.directory
import io
import system
import uuid

import .utils_

Expand Down
8 changes: 4 additions & 4 deletions src/cli.toit
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by an MIT-style license that can be
// found in the package's LICENSE file.
import uuid
import uuid show Uuid
import system

import .cache
Expand Down Expand Up @@ -816,7 +816,7 @@ class OptionPatterns extends Option:
A Uuid option.
*/
class OptionUuid extends Option:
default/uuid.Uuid?
default/Uuid?

/**
Creates a new Uuid option.
Expand Down Expand Up @@ -845,8 +845,8 @@ class OptionUuid extends Option:

type -> string: return "uuid"

parse str/string --for-help-example/bool=false -> uuid.Uuid:
return uuid.parse str --on-error=:
parse str/string --for-help-example/bool=false -> Uuid:
return Uuid.parse str --on-error=:
throw "Invalid value for option '$name': '$str'. Expected a UUID."


Expand Down
10 changes: 5 additions & 5 deletions tests/options_test.toit
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import cli
import expect show *
import uuid
import uuid show Uuid

main:
test-string
Expand Down Expand Up @@ -131,14 +131,14 @@ test-uuid:
expect-null option.default
expect-equals "uuid" option.type

option = cli.OptionUuid "uuid" --default=uuid.NIL
expect-equals uuid.NIL option.default
option = cli.OptionUuid "uuid" --default=Uuid.NIL
expect-equals Uuid.NIL option.default

value := option.parse "00000000-0000-0000-0000-000000000000"
expect-equals uuid.NIL value
expect-equals Uuid.NIL value

value = option.parse "00000000-0000-0000-0000-000000000001"
expect-equals (uuid.parse "00000000-0000-0000-0000-000000000001") value
expect-equals (Uuid.parse "00000000-0000-0000-0000-000000000001") value

expect-throw "Invalid value for option 'uuid': 'foo'. Expected a UUID.":
option.parse "foo"
Expand Down

0 comments on commit 2d720f3

Please sign in to comment.