1 /+ 2 Copyright Elias Batek 2017 - 2018. 3 Distributed under the Boost Software License, Version 1.0. 4 (See accompanying file LICENSE_1_0.txt or copy at 5 https://www.boost.org/LICENSE_1_0.txt) 6 +/ 7 module midigamepad.shell.texts; 8 9 import std.stdio; 10 11 import midigamepad.lib.translation.mappingsfile; 12 13 /++ 14 LF + 2 tabulators 15 +/ 16 enum newLineDoubleTab = "\n\t\t"; 17 18 /++ 19 Prints the app+version info and the license header 20 +/ 21 void printHeader() 22 { 23 writeln("\nMIDI GamePad [v" ~ import("version.txt") ~ `] 24 Copyright (C) 2017-2018 0xEAB`); 25 } 26 27 /++ 28 Prints the help text 29 +/ 30 void printHelp(string app) 31 { 32 writeln(` Usage 33 ======= 34 35 ` ~ app ~ ` [(deviceID mpPath) |--args] 36 37 38 deviceID Numeric ID of the selected MIDI input device 39 mpPath Path to selected mappings file 40 41 42 --help | /? Displays this help text 43 44 --tui | <no args> Launches MIDI GamePad in TUI mode 45 46 --version | -v Prints the version info 47 48 `); 49 } 50 51 /++ 52 Prints the passed MappingsParserException 53 +/ 54 void printMappingsParserException(MappingsParserException ex) 55 { 56 writeln("E:\tAn error occured while parsing the mappings file :("); 57 58 write(newLineDoubleTab); 59 write(ex.msg); 60 61 if (ex.faultyMapping.toString == "") 62 { 63 write(newLineDoubleTab); 64 write("\t"); 65 writeln(ex.faultyMapping); 66 } 67 68 if (ex.next !is null) 69 { 70 write(newLineDoubleTab); 71 write("\t"); 72 writeln(ex.next.msg); 73 } 74 }