tooDo

TooDo is a project that I started to assist in learning the 'D' programming language.
Log | Files | Refs | README | LICENSE

main.d (1320B)


      1 /*********************************************************************
      2 * This is the beginning work on tooDo, a task application written in D.
      3 * This project is more of a learning experience rather than anything actually useful.
      4 *********************************************************************
      5 * - TODO: Figure out structure of files
      6 * - TODO: Figure out how to modify files
      7 * - TODO: Figure out interface
      8 * - TODO: Figure out keybindings
      9 * - TODO: Figure out how to use $XDG for .config files
     10 */
     11 import std.stdio;
     12 import std.string;
     13 import std.json;
     14 
     15 char[] createFile(char[] input) {
     16   char[] newFile;
     17   newFile = strip(input);
     18   newFile ~= ".json";
     19   return newFile;
     20 }
     21 
     22 int createTempFile(File ogFile) {
     23   /* TODO: Copy filename of the original file */
     24   File tempFile = File("temp.json", "w+");
     25 }
     26 
     27 int main() {
     28 
     29   /* Proof of concept for custom filenames */
     30   char[] fileName;
     31   writeln("Please enter a file name: ");
     32   readln(fileName);
     33   fileName = createFile(fileName);
     34 
     35   File file = File(fileName, "w+");
     36 
     37   /* Proof of concept for actually parsing JSON */
     38   File jsonFile = File("test.json", "r");
     39   string s = strip(jsonFile.readln());
     40   JSONValue j = parseJSON(s);
     41 
     42   writeln(j["language"].str); // Should return "D"
     43   writeln(j["rating"].floating); // Should return 3.5
     44 
     45   //file.close;
     46 
     47   return 0;
     48 }