Skip to content

Commit 0f8b5e3

Browse files
committed
Add usage line
1 parent ccc8692 commit 0f8b5e3

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

main.go

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
package main
22

3-
import ui "github.com/gizak/termui"
4-
import "os"
3+
import (
4+
"fmt"
5+
"os"
6+
7+
ui "github.com/gizak/termui"
8+
)
59

610
const statusBarHeight = 1
711
const categoriesHeight = 1
@@ -50,11 +54,16 @@ func initUI() {
5054
}
5155

5256
func main() {
57+
fileNames := os.Args[1:]
58+
if len(fileNames) == 0 {
59+
fmt.Printf("usage: lumberjack logfile1 logfile2 ...")
60+
return
61+
}
62+
5363
initUI()
5464
defer ui.Close()
5565

5666
store := NewStore()
57-
fileNames := os.Args[1:]
5867
state := NewAppState(fileNames, ui.TermHeight(), ui.TermWidth())
5968
addWatchers(fileNames, store.Actions)
6069
go store.ReduceLoop(state)

0 commit comments

Comments
 (0)