commit 13d33ccf00f746aeda3f47d977d7f9b8d7b7da75
parent 3b681e1d2853d654c8293aa5a58694ffe931b5eb
Author: Tyler Clark <tyler.clark@foxide.xyz>
Date: Sun, 9 Feb 2025 21:43:22 -0500
Beginning to implement very basic necesities for program to work
Diffstat:
A | main.d | | | 48 | ++++++++++++++++++++++++++++++++++++++++++++++++ |
A | test.json | | | 1 | + |
2 files changed, 49 insertions(+), 0 deletions(-)
diff --git a/main.d b/main.d
@@ -0,0 +1,48 @@
+/*********************************************************************
+* This is the beginning work on tooDo, a task application written in D.
+* This project is more of a learning experience rather than anything actually useful.
+*********************************************************************
+* - TODO: Figure out structure of files
+* - TODO: Figure out how to modify files
+* - TODO: Figure out interface
+* - TODO: Figure out keybindings
+* - TODO: Figure out how to use $XDG for .config files
+*/
+import std.stdio;
+import std.string;
+import std.json;
+
+char[] createFile(char[] input) {
+ char[] newFile;
+ newFile = strip(input);
+ newFile ~= ".json";
+ return newFile;
+}
+
+int createTempFile(File ogFile) {
+ /* TODO: Copy filename of the original file */
+ File tempFile = File("temp.json", "w+");
+}
+
+int main() {
+
+ /* Proof of concept for custom filenames */
+ char[] fileName;
+ writeln("Please enter a file name: ");
+ readln(fileName);
+ fileName = createFile(fileName);
+
+ File file = File(fileName, "w+");
+
+ /* Proof of concept for actually parsing JSON */
+ File jsonFile = File("test.json", "r");
+ string s = strip(jsonFile.readln());
+ JSONValue j = parseJSON(s);
+
+ writeln(j["language"].str); // Should return "D"
+ writeln(j["rating"].floating); // Should return 3.5
+
+ //file.close;
+
+ return 0;
+}
diff --git a/test.json b/test.json
@@ -0,0 +1 @@
+{ "language": "D", "rating": 3.5, "code": "42" }