diff --git a/distribusi.go b/distribusi.go index ddff375..acf7892 100644 --- a/distribusi.go +++ b/distribusi.go @@ -340,7 +340,7 @@ Example: func distribusify(c *cli.Context, root string, ignore []string) error { var allDirs []string - progress := mkProgressBar() + progress := mkProgressBar(c) if err := filepath.Walk(root, func(fpath string, finfo os.FileInfo, err error) error { @@ -782,8 +782,6 @@ func serveHTTP(fpath string) error { fs := http.FileServer(http.Dir(fpath)) http.Handle("/", fs) - logrus.Infof("distribusi serving from http://localhost%s", port) - if err := http.ListenAndServe(port, nil); err != nil { return err } @@ -859,9 +857,16 @@ func getLogFile() (*os.File, error) { // mkProgressBar creates a customised progress bar. This bar is used to give // real-time updates on the progress of running distribusi. -func mkProgressBar() *progressbar.ProgressBar { +func mkProgressBar(c *cli.Context) *progressbar.ProgressBar { + var description string + if c.Bool("serve") { + description = fmt.Sprintf("distribusifying... live @ http://localhost%s", port) + } else { + description = "distribusifying..." + } + bar := progressbar.NewOptions(-1, - progressbar.OptionSetDescription("distribusifying..."), + progressbar.OptionSetDescription(description), progressbar.OptionSetWriter(ansi.NewAnsiStdout()), progressbar.OptionEnableColorCodes(true), progressbar.OptionShowCount(),