Skip to content

Commit

Permalink
add -auto-archive flag
Browse files Browse the repository at this point in the history
  • Loading branch information
fujiwara committed Jun 28, 2018
1 parent 963c33e commit e5a82f3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,21 @@ $ notico [-channel "#foo"]
- channel_rename
- channel_archive
- channel_unarchive
- channel_left
- team_join
- bot_added

## Options

```
Usage of notico
-auto-archive
Archive the channel which includes nobody automatically
-channel string
Channel to post notification message (default "#admins")
-version
Show versrion
```

## LICENSE

Expand Down
10 changes: 9 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,14 @@ var (
)

func main() {
var showVersion bool
var (
showVersion bool
autoArchive bool
)
flag.StringVar(&channel, "channel", "#admins", "Channel to post notification message")
flag.BoolVar(&showVersion, "version", false, "Show versrion")
flag.BoolVar(&autoArchive, "auto-archive", false, "Archive the channel which includes nobody automatically")
flag.Parse()
if showVersion {
fmt.Println("notico version", version)
return
Expand Down Expand Up @@ -71,6 +76,9 @@ Loop:
domain = ev.Info.Team.Domain
log.Printf("Team Info: %#v", ev.Info.Team)
case *slack.ChannelLeftEvent:
if !autoArchive {
continue
}
info, err := api.GetChannelInfo(ev.Channel)
if err != nil {
log.Printf("failed to get channel info: %s", err)
Expand Down

0 comments on commit e5a82f3

Please sign in to comment.