Split up main package into multiple files

This commit is contained in:
Tim Schubert 2023-11-18 15:02:17 +01:00
parent 00d867b257
commit c9faf272bd
Signed by: dadada
SSH key fingerprint: SHA256:bFAjFH3hR8zRBaJjzQDjc3o4jqoq5EZ87l+KXEjxIz0
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
}