Skip to content

Commit 9d6b05b

Browse files
committed
Namespace ExitCode enum
1 parent 0dd52c3 commit 9d6b05b

File tree

2 files changed

+63
-61
lines changed

2 files changed

+63
-61
lines changed

spec/lit/lit_spec.cr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ describe Lit::Lit do
1010
it "outputs the error" do
1111
status, output = run_lit_in_process("./unknown-path/what.tf")
1212
output.to_s.should contain "File not found!"
13-
status.exit_code.should eq ExitCode::NOINPUT.to_i
13+
status.exit_code.should eq Lit::ExitCode::NOINPUT.to_i
1414
end
1515
end
1616
end

src/lit/exit_code.cr

Lines changed: 62 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,79 @@
11
# Preferred system exit codes as defined by sysexits.h
2-
enum ExitCode
3-
# Successful exit
4-
OK = 0
2+
module Lit
3+
enum ExitCode
4+
# Successful exit
5+
OK = 0
56

6-
# The command was used incorrectly, e.g., with the
7-
# wrong number of arguments, a bad flag, a bad syntax
8-
# in a parameter, etc.
9-
USAGE = 64
7+
# The command was used incorrectly, e.g., with the
8+
# wrong number of arguments, a bad flag, a bad syntax
9+
# in a parameter, etc.
10+
USAGE = 64
1011

11-
# The input data was incorrect in some way. This
12-
# should only be used for user's data and not system
13-
# files.
14-
DATAERR = 65
12+
# The input data was incorrect in some way. This
13+
# should only be used for user's data and not system
14+
# files.
15+
DATAERR = 65
1516

16-
# An input file (not a system file) did not exist or
17-
# was not readable. This could also include errors
18-
# like "No message" to a mailer (if it cared to
19-
# catch it).
20-
NOINPUT = 66
17+
# An input file (not a system file) did not exist or
18+
# was not readable. This could also include errors
19+
# like "No message" to a mailer (if it cared to
20+
# catch it).
21+
NOINPUT = 66
2122

22-
# The user specified did not exist. This might be
23-
# used for mail addresses or remote logins.
24-
NOUSER = 67
23+
# The user specified did not exist. This might be
24+
# used for mail addresses or remote logins.
25+
NOUSER = 67
2526

26-
# The host specified did not exist. This is used in
27-
# mail addresses or network requests.
28-
NOHOST = 68
27+
# The host specified did not exist. This is used in
28+
# mail addresses or network requests.
29+
NOHOST = 68
2930

30-
# A service is unavailable. This can occur if a
31-
# support program or file does not exist. This can also
32-
# be used as a catchall message when something you
33-
# wanted to do doesn't work, but you don't know why.
34-
UNAVAILABLE = 69
31+
# A service is unavailable. This can occur if a
32+
# support program or file does not exist. This can also
33+
# be used as a catchall message when something you
34+
# wanted to do doesn't work, but you don't know why.
35+
UNAVAILABLE = 69
3536

36-
# An internal software error has been detected. This
37-
# should be limited to non-operating system related
38-
# errors as possible.
39-
SOFTWARE = 70
37+
# An internal software error has been detected. This
38+
# should be limited to non-operating system related
39+
# errors as possible.
40+
SOFTWARE = 70
4041

41-
# An operating system error has been detected. This
42-
# is intended to be used for such things as "cannot
43-
# fork", "cannot create pipe", or the like. It
44-
# includes things like getuid returning a user that
45-
# does not exist in the passwd file.
46-
OSERR = 71
42+
# An operating system error has been detected. This
43+
# is intended to be used for such things as "cannot
44+
# fork", "cannot create pipe", or the like. It
45+
# includes things like getuid returning a user that
46+
# does not exist in the passwd file.
47+
OSERR = 71
4748

48-
# Some system file (e.g., /etc/passwd, /var/run/utmp,
49-
# etc.) does not exist, cannot be opened, or has some
50-
# sort of error (e.g., syntax error).
51-
OSFILE = 72
49+
# Some system file (e.g., /etc/passwd, /var/run/utmp,
50+
# etc.) does not exist, cannot be opened, or has some
51+
# sort of error (e.g., syntax error).
52+
OSFILE = 72
5253

53-
# A (user specified) output file cannot be created.
54-
CANTCREAT = 73
54+
# A (user specified) output file cannot be created.
55+
CANTCREAT = 73
5556

56-
# An error occurred while doing I/O on some file.
57-
IOERR = 74
57+
# An error occurred while doing I/O on some file.
58+
IOERR = 74
5859

59-
# Temporary failure, indicating something that is not
60-
# really an error. In sendmail, this means that a
61-
# mailer (e.g.) could not create a connection, and
62-
# the request should be reattempted later.
63-
TEMPFAIL = 75
60+
# Temporary failure, indicating something that is not
61+
# really an error. In sendmail, this means that a
62+
# mailer (e.g.) could not create a connection, and
63+
# the request should be reattempted later.
64+
TEMPFAIL = 75
6465

65-
# The remote system returned something that was
66-
# "not possible" during a protocol exchange.
67-
PROTOCOL = 76
66+
# The remote system returned something that was
67+
# "not possible" during a protocol exchange.
68+
PROTOCOL = 76
6869

69-
# You did not have sufficient permission to perform
70-
# the operation. This is not intended for file system
71-
# problems, which should use `NOINPUT` or `CANTCREAT`,
72-
# but rather for higher level permissions.
73-
NOPERM = 77
70+
# You did not have sufficient permission to perform
71+
# the operation. This is not intended for file system
72+
# problems, which should use `NOINPUT` or `CANTCREAT`,
73+
# but rather for higher level permissions.
74+
NOPERM = 77
7475

75-
# Something was found in an unconfigured or misconfigured state.
76-
CONFIG = 78
76+
# Something was found in an unconfigured or misconfigured state.
77+
CONFIG = 78
78+
end
7779
end

0 commit comments

Comments
 (0)