Moved help message to config
This commit is contained in:
parent
99871ddc73
commit
4df151ea85
@ -1,9 +1,42 @@
|
||||
pub const BUFFER_SIZE = 1024 * 50; // Line limit when parsing file
|
||||
pub const MAX_FILE_SIZE = 5e+4; // 50kb TODO: Put in config file
|
||||
pub const CSV_DELIMITER = ';';
|
||||
pub const MAX_FILE_SIZE = 5e+6; // 5Mb
|
||||
pub const CSV_DELIMITER = ';'; // TODO: Delete
|
||||
|
||||
// Testing
|
||||
pub const TEST_DATA_DIR = "test_data/v0.1.2"; // Maybe put that directly in the build
|
||||
|
||||
// Debug
|
||||
pub const DONT_SEND = true;
|
||||
|
||||
// Help message
|
||||
pub const HELP_MESSAGE = struct {
|
||||
pub const main: []const u8 =
|
||||
\\Welcome to ZipponDB v0.1.1!
|
||||
\\
|
||||
\\Available commands:
|
||||
\\run To run a query.
|
||||
\\db Create or chose a database.
|
||||
\\schema Initialize the database schema.
|
||||
\\quit Stop the CLI with memory safety.
|
||||
\\
|
||||
\\For more informations: https://github.com/MrBounty/ZipponDB
|
||||
\\
|
||||
;
|
||||
pub const db: []const u8 =
|
||||
\\Available commands:
|
||||
\\new Create a new database using a path to a sub folder.
|
||||
\\use Select another ZipponDB folder to use as database.
|
||||
\\metrics Print some metrics of the current database.
|
||||
\\
|
||||
\\For more informations: https://github.com/MrBounty/ZipponDB
|
||||
\\
|
||||
;
|
||||
pub const schema: []const u8 =
|
||||
\\Available commands:
|
||||
\\describe Print the schema use by the currently selected database.
|
||||
\\init Take the path to a schema file and initialize the database.
|
||||
\\
|
||||
\\For more informations: https://github.com/MrBounty/ZipponDB
|
||||
\\
|
||||
;
|
||||
};
|
||||
|
33
src/main.zig
33
src/main.zig
@ -13,6 +13,7 @@ const utils = @import("stuffs/utils.zig");
|
||||
const send = @import("stuffs/utils.zig").send;
|
||||
|
||||
const BUFFER_SIZE = @import("config.zig").BUFFER_SIZE;
|
||||
const HELP_MESSAGE = @import("config.zig").HELP_MESSAGE;
|
||||
|
||||
const State = enum {
|
||||
expect_main_command,
|
||||
@ -119,18 +120,7 @@ pub fn main() !void {
|
||||
state = .expect_schema_command;
|
||||
},
|
||||
.keyword_help => {
|
||||
send("{s}", .{
|
||||
\\Welcome to ZipponDB v0.1.1!
|
||||
\\
|
||||
\\Available commands:
|
||||
\\run To run a query.
|
||||
\\db Create or chose a database.
|
||||
\\schema Initialize the database schema.
|
||||
\\quit Stop the CLI with memory safety.
|
||||
\\
|
||||
\\ For more informations: https://github.com/MrBounty/ZipponDB
|
||||
\\
|
||||
});
|
||||
send("{s}", .{HELP_MESSAGE.main});
|
||||
state = .end;
|
||||
},
|
||||
.keyword_quit => state = .quit,
|
||||
@ -159,15 +149,7 @@ pub fn main() !void {
|
||||
state = .end;
|
||||
},
|
||||
.keyword_help => {
|
||||
send("{s}", .{
|
||||
\\Available commands:
|
||||
\\new Create a new database using a path to a sub folder.
|
||||
\\use Select another ZipponDB folder to use as database.
|
||||
\\metrics Print some metrics of the current database.
|
||||
\\
|
||||
\\ For more informations: https://github.com/MrBounty/ZipponDB
|
||||
\\
|
||||
});
|
||||
send("{s}", .{HELP_MESSAGE.db});
|
||||
state = .end;
|
||||
},
|
||||
else => {
|
||||
@ -237,14 +219,7 @@ pub fn main() !void {
|
||||
},
|
||||
.keyword_init => state = .expect_path_to_schema,
|
||||
.keyword_help => {
|
||||
send("{s}", .{
|
||||
\\Available commands:
|
||||
\\describe Print the schema use by the currently selected database.
|
||||
\\init Take the path to a schema file and initialize the database.
|
||||
\\
|
||||
\\ For more informations: https://github.com/MrBounty/ZipponDB
|
||||
\\
|
||||
});
|
||||
send("{s}", .{HELP_MESSAGE.schema});
|
||||
state = .end;
|
||||
},
|
||||
else => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user