github.com/scaleway/scaleway-cli@v1.11.1/pkg/cli/cmd_events.go (about) 1 // Copyright (C) 2015 Scaleway. All rights reserved. 2 // Use of this source code is governed by a MIT-style 3 // license that can be found in the LICENSE.md file. 4 5 package cli 6 7 import "github.com/scaleway/scaleway-cli/pkg/commands" 8 9 var cmdEvents = &Command{ 10 Exec: runEvents, 11 UsageLine: "events [OPTIONS]", 12 Description: "Get real time events from the API", 13 Help: "Get real time events from the API.", 14 } 15 16 func init() { 17 cmdEvents.Flag.BoolVar(&eventsHelp, []string{"h", "-help"}, false, "Print usage") 18 } 19 20 // Flags 21 var eventsHelp bool // -h, --help flag 22 23 func runEvents(cmd *Command, rawArgs []string) error { 24 if eventsHelp { 25 return cmd.PrintUsage() 26 } 27 if len(rawArgs) != 0 { 28 return cmd.PrintShortUsage() 29 } 30 31 args := commands.EventsArgs{} 32 ctx := cmd.GetContext(rawArgs) 33 return commands.RunEvents(ctx, args) 34 }