Split up main package into multiple files

This commit is contained in:
Tim Schubert 2023-11-18 15:02:17 +01:00 committed by Tim Schubert
parent 8ac40b162e
commit d089f2f7fa
5 changed files with 192 additions and 154 deletions

44
args.go Normal file
View file

@ -0,0 +1,44 @@
package main
import (
"flag"
"log"
"os"
)
func getArgs() (*string, *bool, *string, *string, *string) {
cwd, err := os.Getwd()
if err != nil {
log.Fatalf("Failed to get working directory %s", err)
}
gitdir := flag.String(
"C",
cwd,
"The directory containing the git repository in which to archive the pads.",
)
doPush := flag.Bool(
"push",
false,
"Push the changes to the remote specified by remoteUrl.",
)
username := flag.String(
"username",
"",
"The username for authenticating to the remote.",
)
password := flag.String(
"password",
os.Getenv("GIT_PASSWORD"),
"The password for authenticating to the remote. Can also be specified via the environment variable GIT_PASSWORD.",
)
remoteUrl := flag.String(
"url",
"",
"URL to push changes to.",
)
flag.Parse()
return gitdir, doPush, username, password, remoteUrl
}