/// Enum holding the different possible Error return values.
#[derive(Debug)]
pub enum HelpMessage {
    NotEnoughArgs,
    WrongArgOS,
    MissingFlagValueO,
    MissingFlagValueX,
    WrongDirectoryArg,
    FailedToGetFile,
    FailedToMakeFile,
    BufferFlushFailed,
    NoValueForFlagM,
    NoValueForFlagD,
    CannotCombineFlagsMF,
    NoDestinationSpecified,
    NoParentPath,
    FailedMakingDirs,
    FailedWorkingPath,
    FailedRecursionFS,
    PrintingHelp,
}

/// Prints the help message which gets called with '-h' or '--help'
pub fn help_message()  {

    println!("");
    println!("\t\t\t\x1b[4;32;40;1mWELCOME TO BUSBI!\x1b[0m\n");
    println!(" This Command Line Tool is for creating bad USB scripts AKA ducky scripts for copying");
    println!(" over targeted scripts or entire folders of them onto another machine through a ducky script");
    println!(" and possibly executing said scripts.");
    println!(" Note that the intended use is for shell scripts like '.sh' and '.ps1' but any text based");
    println!(" file works. So you can copy code or whole essays this way.\n");
    println!(" The files generated by busbi use the Flipper Zero BadUSB File format, see their webpage:\n");
    println!(" https://developer.flipper.net/flipperzero/doxygen/badusb_file_format.html");
    println!("");
    print!(" ");
    print!("\x1b[4;31mUSAGE:\x1b[0m");
    println!(" busbi [Options] [SOURCE FILE/DIR] [DESTINATION FILE/DIR]\n");
    print!(" ");
    println!("\x1b[4;35mPossible Options:\x1b[0m\n");
    println!("\t-o  --os         Selects the OS that you are targeting, i.e where your Bad USB\n\
              \t                 script will run. If you are running the busbi command on a\n\
              \t                 Windows or Unix system but the machine you want to target with the\n\
              \t                 generated script is a linux machine, then set this to 'unix'.\n");
    print!("\t                 ");
    println!("\x1b[4mDefault: Windows\x1b[0m\n");
    println!("\t-h  --help       Prints this help message.\n");
    println!("\t-d  --directory  Use this flag to target a directory, this flag MUST be followed by\n\
              \t                 the SOURCE and DESTINATION arguments. CANNOT be combined with '-m'.\n\
              \t                 The specified directory will be written in it's entirety to the\n\
              \t                 bad usb file, which will have the name of your DESTINATION\n\
              \t                 argument. DESTINATION MUST end with '.txt'.\n\
              \t                 When the bad USB script is used on the target system it will\n\
              \t                 replicate the folders and files in their entirety on the host\n\
              \t                 system under the $HOME\\DESTINATION directory or $HOME/DESTINATION\n\
              \t                 if on Unix.\n\
              \t                 See the Examples below for more help.\n
        ");
    println!("\t-m  --many       Use this flag to target a directory containing many files and/or\n\
              \t                 scripts. Each file inside the directory and it's sub-directories\n\
              \t                 will be turned into their own bad usb scripts under the DESTINATION\n\
              \t                 folder it creates. Note that the DESTINATION folder will be created\n\
              \t                 in the directory where you ran the busbi command.\n\
              \t                 This flag CANNOT be used together with '-d'. Just like with '-d' you\n\
              \t                 must specify the SOURCE DIR and DESTINATION right after. Essentially\n\
              \t                 it must be the last flag/option you use.\n\
              \t                 The created script -if run- will copy the contents of their target\n\
              \t                 file onto the host and will be put under the $HOME/DESTINATION\n\
              \t                 folder.");
    print!("\t                 ");
    print!("\x1b[4mNote:\x1b[0m");
    print!(" If used with '-x' option, this will cause all generated bad\n\
              \t                 USB scripts to execute the file they copy over onto the host.\n\n");
    println!("\t-c  --close      Closes the terminal/powershell window when the bad USB script\n\
              \t                 finishes.\n");
    println!("\t-x  --execute    Use this option to specify 1 file to execute at the end of the\n\
              \t                 bad usb script. Can be used with '-d' and '-m'.\n\
              \t                 If used with '-m' it will make every bad USB script generated\n\
              \t                 execute the file it copied over. Note that you should still\n\
              \t                 specify the target folder you put in the DESTINATION.\n\
              \t                 See examples below.\n\
              \t                 If used with '-d' you simply specify the file in the directory\n\
              \t                 you are targeting that should be executed at the end when all\n\
              \t                 files have been copied over.\n\
              \t                 See the examples below.");
    print!("\t                 ");
    print!("\x1b[4mNote:\x1b[0m");
    print!(" This can be used to run scripts that were not explicitely\n\
              \t                 copied over, as long as they are in the $HOME/DESTINAITON folder.\n");
    print!(" ");
    println!("\x1b[4;32mExamples:\x1b[0m");
    println!("");
    println!("\tAll examples will assume the existence of these files and folder:\n");
    println!("\t\tscripts_test/
\t\t├── hello.sh
\t\t├── nested_folder
\t\t│   └── count.sh
\t\t└── whoami.sh
");
    println!("\t\x1b[4mSimple Usage:\x1b[0m\n");
    println!("\t\tbusbi scripts_test/hello.sh new_busbi.txt\n");
    println!("\tWill create the following file:");
    println!("\t\t.
\t\t├── new_busbi.txt
\t\t└── scripts_test
\t\t    ├── hello.sh
\t\t    ├── nested_folder
\t\t    │   └── count.sh
\t\t    └── whoami.sh
");
    println!("\t\x1b[4mTarget Unix and Close the terminal/powershell at script end:\x1b[0m\n");
    println!("\t\tbusbi -o unix -c scripts_test/hello.sh new_busbi.txt\n");
    println!("\t\x1b[4mTarget Unix and execute target shell script:\x1b[0m\n");
    println!("\t\tbusbi -o unix -x scripts_test/hello.sh scripts_test/hello.sh new_busbi.txt\n");
    println!("\t\x1b[4mTarget Unix and target directory for copying:\x1b[0m\n");
    println!("\t\tbusbi -o unix -d scripts_test/ large_busbi.txt\n");
    println!("\tWill create the following file:");
    println!("\t\t.
\t\t├── large_busbi.txt
\t\t└── scripts_test
\t\t    ├── hello.sh
\t\t    ├── nested_folder
\t\t    │   └── count.sh
\t\t    └── whoami.sh
");
    println!("\t\x1b[4mTarget Unix and create many bad USB scripts:\x1b[0m\n");
    println!("\t\tbusbi -o unix -m scripts_test/ new_folder\n");
    println!("\tWill create the following folder with files:");
    println!("\t\t.
\t\t├── new_folder
\t\t│   └── scripts_test
\t\t│       ├── hello.txt
\t\t│       ├── nested_folder
\t\t│       │   └── count.txt
\t\t│       └── whoami.txt
\t\t└── scripts_test
\t\t    ├── hello.sh
\t\t    ├── nested_folder
\t\t    │   └── count.sh
\t\t    └── whoami.sh
");
    print!("\t\x1b[4mNote:\x1b[0m");
    println!(" That the command recreated the nested folder structure and turned every\n\
        \t      script into a bad USB file without replacing the originals.\n");
    println!("\t\x1b[4mCreate many bad USB scripts and each executes copied file:\x1b[0m\n");
    println!("\t\tbusbi -x scripts_test -m scripts_test/ new_folder\n");
    println!("\t\x1b[4mUnix/Close/Execute/Target directory:\x1b[0m\n");
    println!("\t\tbusbi -o unix -c -x scripts_test/nested_folder/count.sh -d scripts_test/ large_busbi.txt\n");
    println!("\tWill still just create a single file:");
    println!("\t\t.
\t\t├── large_busbi.txt
\t\t└── scripts_test
\t\t    ├── hello.sh
\t\t    ├── nested_folder
\t\t    │   └── count.sh
\t\t    └── whoami.sh
");
}
