Skip to content

Commit ac17371

Browse files
committed
0.4.0
1 parent 0ecdc7f commit ac17371

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

dub.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "dfmt",
33
"description": "Dfmt is a formatter for D source code",
4-
"version": "0.4.0-beta",
4+
"version": "0.4.0",
55
"targetType": "executable",
66
"license": "BSL-1.0",
77
"dependencies": {

src/dfmt/main.d

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
module dfmt.main;
77

8+
enum VERSION = "0.4.0";
9+
810
version (NoMain)
911
{
1012
}
@@ -24,6 +26,7 @@ else
2426
Config optConfig;
2527
optConfig.pattern = "*.d";
2628
bool showHelp;
29+
bool showVersion;
2730

2831
void handleBooleans(string option, string value)
2932
{
@@ -58,6 +61,7 @@ else
5861
try
5962
{
6063
getopt(args,
64+
"version", &showVersion,
6165
"align_switch_statements", &handleBooleans,
6266
"brace_style", &optConfig.dfmt_brace_style,
6367
"end_of_line", &optConfig.end_of_line,
@@ -80,6 +84,12 @@ else
8084
return 1;
8185
}
8286

87+
if (showVersion)
88+
{
89+
writeln(VERSION);
90+
return 0;
91+
}
92+
8393
if (showHelp)
8494
{
8595
printHelp();
@@ -149,11 +159,13 @@ else
149159

150160
private void printHelp()
151161
{
152-
writeln(`dfmt 0.4.0-beta
162+
writeln(`dfmt `, VERSION, `
163+
https://github.com/Hackerpilot/dfmt
153164
154165
Options:
155166
--help | -h Print this help message
156167
--inplace Edit files in place
168+
--version Print the version number and then exit
157169
158170
Formatting Options:
159171
--align_switch_statements

0 commit comments

Comments
 (0)