Clean up before making public

This commit is contained in:
webb 2020-09-03 17:19:15 -04:00
parent d503eaaac5
commit 756af7cb6f
No known key found for this signature in database
GPG Key ID: 8B6F0D2784D22DB2
2 changed files with 21 additions and 20 deletions

20
cfg.go Normal file
View File

@ -0,0 +1,20 @@
package main
import (
"errors"
"os"
)
func getUploadKey() (string, error) {
PXL_KEY := os.Getenv("PXL_KEY")
if PXL_KEY != "" {
return PXL_KEY, nil
}
MIRAGE_KEY := os.Getenv("MIRAGE_KEY")
if MIRAGE_KEY != "" {
return MIRAGE_KEY, nil
}
return "", errors.New("Upload key not set as environment variable!")
}

21
main.go
View File

@ -1,7 +1,6 @@
package main
import (
"errors"
"fmt"
"gitea.com/webb/teal"
"os"
@ -11,24 +10,6 @@ var itCl = teal.Client{
UserAgent: "interrupt v0.0.0",
}
func printUsage() {
fmt.Println("Usage \n")
}
func getUploadKey() (string, error) {
PXL_KEY := os.Getenv("PXL_KEY")
if PXL_KEY != "" {
return PXL_KEY, nil
}
MIRAGE_KEY := os.Getenv("MIRAGE_KEY")
if MIRAGE_KEY != "" {
return MIRAGE_KEY, nil
}
return "", errors.New("Upload key not set as environment variable!")
}
func main() {
switch os.Args[1] {
case "upload":
@ -36,7 +17,7 @@ func main() {
fmt.Println("ERROR: too many arguments!")
os.Exit(1)
} else if len(os.Args[2:]) == 0 {
fmt.Println("Please supply a file to upload.")
fmt.Println("ERROR: Please supply a file to upload.")
os.Exit(1)
}