~mclehman/guestctl

ref: df04e7d259d451c65a6d0716b82af0ada5ce249a guestctl/lib/App/Guestctl/Common.pm6 -rw-r--r-- 1.0 KiB View raw
df04e7d2 — 0xFORDCOMMA Fix typo in manage-prompt comment. 1 year, 5 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
unit module App::Guestctl::Common;

# Enum members are paired with their domain string representations.
# For GuestStatus, the string representations are used when status is output.
# For _____Command, the string representations are used to parse ______Action
# elements. These Action types are used to constrain command line arguments.
enum GuestStatus is export
    (Running => "up",
     Stopped => "down");

enum GuestCommand is export
    (Up      => "up",
     Down    => "down",
     Restart => "restart",
     Status  => "status");

enum ManageCommand is export
    (Update  => "update",
     Sync    => "sync",
     Create  => "create");

enum RegisterCommand is export
    (Remote  => "remote",
     Host    => "host");

# I do not like this structure, but don't have a better option.
# Adding export declarations seriously harms readability.
subset GuestAction is export
    of Str where * eq any  GuestCommand::.values>>.Str;

subset ManageAction is export
    of Str where * eq any ManageCommand::.values>>.Str;