Skip to content

Commit

Permalink
Merge pull request gordon-cs#103 from gordon-cs/fix-h
Browse files Browse the repository at this point in the history
Adjusted -h flag to be consistent
  • Loading branch information
Davideo37 authored Apr 19, 2022
2 parents 2a3bbd2 + 490dd51 commit 9005a35
Showing 1 changed file with 10 additions and 27 deletions.
37 changes: 10 additions & 27 deletions src/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,7 @@ var overlayVideoPath string
// Main function
func main() {
// Ask the user for options
lowQuality, helpFlag, saveTemps, useOldfade := parseFlags(&slideshowDirectory, &outputLocation, &tempLocation, &overlayVideoPath)
if *helpFlag {
displayHelpMessage()
return
}
lowQuality, saveTemps, useOldfade := parseFlags(&slideshowDirectory, &outputLocation, &tempLocation, &overlayVideoPath)

// Create a temporary folder to store temporary files created when created a video
tempLocation = createTemporaryFolder(tempLocation)
Expand Down Expand Up @@ -121,18 +117,17 @@ func createDirectory(location string) {
}
}

func parseFlags(templateName *string, outputPath *string, tempPath *string, overlayVideoPath *string) (*bool, *bool, *bool, *bool) {
var lowQuality = flag.Bool("l", false, "Include to produce a lower quality video (1280x720 => 852x480)")
var help = flag.Bool("h", false, "Include option flag to display list of possible flags and their uses")
var saveTemps = flag.Bool("s", false, "Include to save the temporary files after production")
var useOldFade = flag.Bool("f", false, "Include to use traditional ffmpeg fade")
flag.StringVar(templateName, "t", "", "Specify template to use")
flag.StringVar(outputPath, "o", "", "Specify output location")
flag.StringVar(tempPath, "td", "", "Specify temp directory location (If user wishes to save temporary files created during production)")
flag.StringVar(overlayVideoPath, "ov", "", "Specify test video location to create overlay video")
func parseFlags(templateName *string, outputPath *string, tempPath *string, overlayVideoPath *string) (*bool, *bool, *bool) {
var lowQuality = flag.Bool("l", false, "(boolean): Low Quality, include to generate a lower quality video (480p instead of 720p)")
var saveTemps = flag.Bool("s", false, "(boolean): Save Temporaries, include to save temporary files generated during video process)")
var useOldFade = flag.Bool("f", false, "(boolean): Fadetype, include to use the non-xfade default transitions for video")
flag.StringVar(templateName, "t", "", "[filepath]: Template Name, specify a template to use (if not included searches current folder for template)")
flag.StringVar(outputPath, "o", "", "[filepath]: Output Location, specify where to store final result (default is current directory)")
flag.StringVar(tempPath, "td", "", "[filepath]: Temporary Directory, used to specify a location to store the temporary files used in video production (default is OS' temp folder/storybuilder-*)")
flag.StringVar(overlayVideoPath, "ov", "", "[filepath]: Overlay Video, specify test video location to create overlay video")
flag.Parse()

return lowQuality, help, saveTemps, useOldFade
return lowQuality, saveTemps, useOldFade
}

func splitFileNameFromDirectory(slideshowDirectory string) (string, string) {
Expand Down Expand Up @@ -719,15 +714,3 @@ func createOverlaidVideoForTesting(trueVideo string, destinationLocation string)
output, err := cmd.CombinedOutput()
checkCMDError(output, err)
}

func displayHelpMessage() {
println("Usage: program-name [OPTIONS]\n")
println("Options list:\n")
println(" -t [filepath]: Template Name, specify a template to use (if not included searches current folder for template)\n")
println(" -s (boolean): Save Temporaries, include to save temporary files generated during video process)\n")
println(" -td [filepath]: Temporary Directory, used to specify a location to store the temporary files used in video production (default is current-directory/temp)\n")
println(" -o [filepath]: Output Location, specify where to store final result (default is current directory)\n")
println(" -l (boolean): Low Quality, include to generate a lower quality video (480p instead of 720p)\n")
println(" -v (boolean): Verbosity, include to increase the verbosity of the status messages printed during video process\n")
println(" -h (boolean): Help, include to display this help message and quit\n")
}

0 comments on commit 9005a35

Please sign in to comment.