started new logger output
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -46,57 +46,60 @@ func main() {
|
||||
logger.SetLogLevel(level)
|
||||
|
||||
if progressBars != nil && *progressBars {
|
||||
progress.Init()
|
||||
progress.Start()
|
||||
}
|
||||
|
||||
if inDir == nil || *inDir == "" {
|
||||
logger.Log.Panic("input directory not specified")
|
||||
logger.E("input directory not specified")
|
||||
os.Exit(1)
|
||||
}
|
||||
iDir := path.Clean(*inDir)
|
||||
inDir = &iDir
|
||||
logger.Log.Infof("input directory: %s", *inDir)
|
||||
logger.I("input directory: %s", *inDir)
|
||||
|
||||
if outDir == nil || *outDir == "" {
|
||||
logger.Log.Panic("output directory not specified")
|
||||
logger.E("output directory not specified")
|
||||
os.Exit(1)
|
||||
}
|
||||
oDir := path.Clean(*outDir)
|
||||
outDir = &oDir
|
||||
logger.Log.Infof("output directory: %s", *outDir)
|
||||
logger.I("output directory: %s", *outDir)
|
||||
|
||||
if createOutDir != nil && *createOutDir {
|
||||
if _, err := os.Stat(*outDir); os.IsNotExist(err) {
|
||||
logger.Log.Debugf("output directory '%s' does not exist", *outDir)
|
||||
logger.Log.Debugf("trying to create output directory: %s", *outDir)
|
||||
logger.D("output directory '%s' does not exist", *outDir)
|
||||
logger.D("trying to create output directory: %s", *outDir)
|
||||
err := os.MkdirAll(*outDir, 0755)
|
||||
if err != nil {
|
||||
logger.Log.Panic(err)
|
||||
}
|
||||
logger.Log.Noticef("created output directory: %s", *outDir)
|
||||
logger.I("created output directory: %s", *outDir)
|
||||
} else {
|
||||
logger.Log.Noticef("output directory '%s' already exists", *outDir)
|
||||
logger.I("output directory '%s' already exists", *outDir)
|
||||
}
|
||||
}
|
||||
|
||||
if fD, err := os.Stat(*outDir); os.IsNotExist(err) {
|
||||
logger.Log.Panicf("output directory '%s' does not exist, try -create parameter or create manually", *outDir)
|
||||
logger.Eexit(err, "output directory '%s' does not exist, try -create parameter or create manually", *outDir)
|
||||
} else {
|
||||
if fD == nil {
|
||||
logger.Log.Panicf("something went wrong, could not get file handle for output dir %s", *outDir)
|
||||
logger.P("something went wrong, could not get file handle for output dir %s", *outDir)
|
||||
} else if !fD.IsDir() {
|
||||
logger.Log.Panicf("output directory '%s' is not a directory", *outDir)
|
||||
logger.E("output directory '%s' is not a directory", *outDir)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
logger.Log.Debug("reading global config...")
|
||||
logger.D("reading global config...")
|
||||
configFilename := *inDir + "/config.yml"
|
||||
err := mark2web.Config.ReadFromFile(configFilename)
|
||||
if err != nil {
|
||||
logger.Log.Panicf("could not read file '%s': %s", configFilename, err)
|
||||
logger.Eexit(err, "could not read file '%s'", configFilename)
|
||||
}
|
||||
mark2web.Config.Directories.Input = *inDir
|
||||
mark2web.Config.Directories.Output = *outDir
|
||||
|
||||
logger.Log.Debugf("reading input directory %s", *inDir)
|
||||
logger.D("reading input directory %s", *inDir)
|
||||
|
||||
defaultTemplate := "base.html"
|
||||
defaultInputFile := "README.md"
|
||||
|
||||
Reference in New Issue
Block a user