Tooling für das Veröffentlichen von Pentaradio-Folgen
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

52 lines
1.2 KiB

/*******************************************************************************
* Copyright 2022 Stefan Majewsky <majewsky@gmx.net>
* SPDX-License-Identifier: GPL-3.0-only
* Refer to the file "LICENSE" for details.
*******************************************************************************/
package main
import (
"fmt"
"os"
"path/filepath"
)
func main() {
if len(os.Args) != 2 {
usage(1)
}
switch os.Args[1] {
case "upload":
Upload(Scan())
case "generate":
Generate(Scan())
case "help", "--help":
usage(0)
}
}
func must(err error) {
if err != nil {
fail(err.Error())
}
}
func fail(msg string, args ...interface{}) {
if len(args) > 0 {
msg = fmt.Sprintf(msg, args...)
}
fmt.Fprintln(os.Stderr, "ERROR: "+msg)
os.Exit(1)
}
func usage(exitCode int) {
fmt.Fprintf(os.Stderr,
"Usage:\n\n"+
" %[1]s upload - Upload all relevant files for one episode to <sftp://ftp.c3d2.de>.\n"+
" %[1]s generate - Generate the c3d2-web news entry XML file for one episode.\n\n"+
"All relevant files (audios, chapter marks file, shownotes Markdown file) must be in the working directory.\n",
filepath.Base(os.Args[0]),
)
os.Exit(exitCode)
}