GenGo

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 3dba9d761b8b07e232e127f6f8681db329f28bad
parent 472b849be6ecf273e5da291e8af41f9ecabac08e
Author: Tyler Clark <tyler.clark@foxide.xyz>
Date:   Thu,  8 Jan 2026 16:12:22 -0500

Improving help and adding dir copying.

This commit improves the help menu and adds the ability to copy a source
directory to a destination. This is still very rough and will need to be
improved for recursive copies. We have also 'removed' the ability to convert
files until we can get the recursive copying working. The function is still
there, it is just not accessible by the user.

Diffstat:
Mmain.go | 29++++++++++++++++++++---------
1 file changed, 20 insertions(+), 9 deletions(-)

diff --git a/main.go b/main.go @@ -2,8 +2,8 @@ /* Eventually, this might replace SSG */ /*****************************************************************/ -/* TODO: Basic functionality for converting markdown/org to html */ -/* TODO: Mirroring dir structure of source files */ +/* DONE: Basic functionality for converting markdown/org to html */ +/* DONE: Mirroring dir structure of source files */ /* TODO: RSS generator built in */ /* TODO: Sitemap generator */ /*****************************************************************/ @@ -33,13 +33,19 @@ const version = "0.01" func ValidateFile(filename string) { _, err := os.Stat(filename) if os.IsNotExist(err) { - fmt.Fprintln(os.Stderr, "No file found") + fmt.Fprintln(os.Stderr, "No file or directory found!") os.Exit(1) - } else { - ConvertFile(filename) } } +/* This is a test function to try to copy a directory */ +func DirSetup(source string, destination string) { + ValidateFile(source) + fsys := os.DirFS(source) + os.CopyFS(destination, fsys) + fmt.Printf("Directory: %v copied\n", source) +} + func RemoveExt(filename string) string { return filename[:len(filename)-len(path.Ext(filename))] } @@ -56,8 +62,11 @@ func ConvertFile(filename string) { fmt.Println(string(output)) } -func callHelp() { - println("One day this will be a useful help message") +func CallHelp() { + println("Usage Information:") + println("gengo (-h:-v) [source directory] [destination directory]") + println("-h: Prints this help menu") + println("-v: Prints version information for gengo") } func ArgParser (argument[] string) { @@ -67,13 +76,15 @@ func ArgParser (argument[] string) { for i := 0; i < cArgs; i++ { switch argument[i] { case "-h", "--help": - callHelp() + CallHelp() os.Exit(0) case "-v", "--version": println("Version:", version) os.Exit(0) default: - ValidateFile(argument[i]) + DirSetup(argument[i], argument[i + 1]) + i++ + //ValidateFile(argument[i]) } } }