diff options
author | Christian Muehlhaeuser <muesli@gmail.com> | 2022-02-03 02:19:57 +0100 |
---|---|---|
committer | Christian Muehlhaeuser <muesli@gmail.com> | 2022-02-03 02:35:47 +0100 |
commit | 4ff06a0ea3972b068a5136fca24f75791bfc6b4c (patch) | |
tree | baa9ac69348c03be5c4c998f77763ff206d88ab0 | |
parent | 6bb6b06c959514f71344bd096e5d279f5463eb14 (diff) |
Replace Cobra with Coral
-rw-r--r-- | .github/workflows/build.yml | 2 | ||||
-rw-r--r-- | countdown.go | 6 | ||||
-rw-r--r-- | go.mod | 2 | ||||
-rw-r--r-- | go.sum | 36 | ||||
-rw-r--r-- | label.go | 8 | ||||
-rw-r--r-- | main.go | 6 | ||||
-rw-r--r-- | profile.go | 16 | ||||
-rw-r--r-- | recording.go | 34 | ||||
-rw-r--r-- | replaybuffer.go | 20 | ||||
-rw-r--r-- | scene.go | 24 | ||||
-rw-r--r-- | scenecollection.go | 16 | ||||
-rw-r--r-- | sceneitems.go | 28 | ||||
-rw-r--r-- | sources.go | 12 | ||||
-rw-r--r-- | stream.go | 20 | ||||
-rw-r--r-- | studiomode.go | 24 | ||||
-rw-r--r-- | virtualcam.go | 20 |
16 files changed, 126 insertions, 148 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2711ae6..e658e4f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,7 +5,7 @@ jobs: build: strategy: matrix: - go-version: [~1.11, ^1] + go-version: [~1.12, ^1] os: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.os }} env: diff --git a/countdown.go b/countdown.go index c9cdcc8..a8e7c95 100644 --- a/countdown.go +++ b/countdown.go @@ -5,13 +5,13 @@ import ( "fmt" "time" - "github.com/spf13/cobra" + "github.com/muesli/coral" ) -var countdownCmd = &cobra.Command{ +var countdownCmd = &coral.Command{ Use: "countdown", Short: "Triggers a countdown and continuously updates a label with the remaining time", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *coral.Command, args []string) error { if len(args) < 2 { return errors.New("countdown requires a label and the countdown in seconds") } @@ -5,5 +5,5 @@ go 1.13 require ( github.com/andreykaipov/goobs v0.8.0 github.com/dustin/go-humanize v1.0.0 - github.com/spf13/cobra v0.0.5 + github.com/muesli/coral v1.0.0 ) @@ -1,45 +1,23 @@ -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/andreykaipov/goobs v0.8.0 h1:pUG/nsRj6Au/BuneajJehsxBx+6o2EZK4Rvdhkj2Kr8= github.com/andreykaipov/goobs v0.8.0/go.mod h1:LUUc1aXWR0B6HrwKC2LE+JtW85aiYInXeowv4AtzGvY= -github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= -github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= -github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= +github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/muesli/coral v1.0.0 h1:odyqkoEg4aJAINOzvnjN4tUsdp+Zleccs7tRIAkkYzU= +github.com/muesli/coral v1.0.0/go.mod h1:bf91M/dkp7iHQw73HOoR9PekdTJMTD6ihJgWoDitde8= github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d h1:VhgPp6v9qf9Agr/56bj7Y/xa04UccTW04VP0Qed4vnQ= github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d/go.mod h1:YUTz3bUH2ZwIWBy3CJBeOBEugqcmXREj14T+iG/4k4U= -github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= -github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cobra v0.0.5 h1:f0B+LkLX6DtmRH1isoNA9VTtNUK9K8xYd28JNNfOv/s= -github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= -github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= -github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= -github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= -github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= -golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= @@ -4,21 +4,21 @@ import ( "errors" "github.com/andreykaipov/goobs/api/requests/sources" - "github.com/spf13/cobra" + "github.com/muesli/coral" ) var ( - labelCmd = &cobra.Command{ + labelCmd = &coral.Command{ Use: "label", Short: "manage text labels", Long: `The label command manages text labels`, RunE: nil, } - textCmd = &cobra.Command{ + textCmd = &coral.Command{ Use: "text", Short: "Changes a text label", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *coral.Command, args []string) error { if len(args) < 2 { return errors.New("text requires a source and the new text") } @@ -6,7 +6,7 @@ import ( "os" "github.com/andreykaipov/goobs" - "github.com/spf13/cobra" + "github.com/muesli/coral" ) var ( @@ -15,7 +15,7 @@ var ( port uint32 version string - rootCmd = &cobra.Command{ + rootCmd = &coral.Command{ Use: "obs-cli", Short: "obs-cli is a command-line remote control for OBS", } @@ -35,7 +35,7 @@ func main() { } func init() { - cobra.OnInitialize(connectOBS) + coral.OnInitialize(connectOBS) rootCmd.PersistentFlags().StringVar(&host, "host", "localhost", "host to connect to") rootCmd.PersistentFlags().StringVar(&password, "password", "", "password for connection") rootCmd.PersistentFlags().Uint32VarP(&port, "port", "p", 4444, "port to connect to") @@ -6,37 +6,37 @@ import ( "strings" "github.com/andreykaipov/goobs/api/requests/profiles" - "github.com/spf13/cobra" + "github.com/muesli/coral" ) var ( - profileCmd = &cobra.Command{ + profileCmd = &coral.Command{ Use: "profile", Short: "manage profiles", Long: `The profile command manages profiles`, RunE: nil, } - listProfileCmd = &cobra.Command{ + listProfileCmd = &coral.Command{ Use: "list", Short: "List all profiles", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *coral.Command, args []string) error { return listProfiles() }, } - getProfileCmd = &cobra.Command{ + getProfileCmd = &coral.Command{ Use: "get", Short: "Get the current profile", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *coral.Command, args []string) error { return getProfile() }, } - setProfileCmd = &cobra.Command{ + setProfileCmd = &coral.Command{ Use: "set", Short: "Set the current profile", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *coral.Command, args []string) error { if len(args) < 1 { return errors.New("set requires a profile name as argument") } diff --git a/recording.go b/recording.go index 7bb8a5e..f4d4c3e 100644 --- a/recording.go +++ b/recording.go @@ -6,74 +6,74 @@ import ( "strconv" "github.com/dustin/go-humanize" - "github.com/spf13/cobra" + "github.com/muesli/coral" ) var ( - recordingCmd = &cobra.Command{ + recordingCmd = &coral.Command{ Use: "recording", Short: "manage recordings", Long: `The recording command manages recordings`, RunE: nil, } - startStopRecordingCmd = &cobra.Command{ + startStopRecordingCmd = &coral.Command{ Use: "toggle", Short: "Toggle recording", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *coral.Command, args []string) error { return startStopRecording() }, } - startRecordingCmd = &cobra.Command{ + startRecordingCmd = &coral.Command{ Use: "start", Short: "Starts recording", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *coral.Command, args []string) error { return startRecording() }, } - stopRecordingCmd = &cobra.Command{ + stopRecordingCmd = &coral.Command{ Use: "stop", Short: "Stops recording", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *coral.Command, args []string) error { return stopRecording() }, } - pauseRecordingCmd = &cobra.Command{ + pauseRecordingCmd = &coral.Command{ Use: "pause", Short: "manage paused state", } - enablePauseRecordingCmd = &cobra.Command{ + enablePauseRecordingCmd = &coral.Command{ Use: "enable", Short: "Pause recording", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *coral.Command, args []string) error { return pauseRecording() }, } - resumePauseRecordingCmd = &cobra.Command{ + resumePauseRecordingCmd = &coral.Command{ Use: "resume", Short: "Resume recording", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *coral.Command, args []string) error { return resumeRecording() }, } - togglePauseRecordingCmd = &cobra.Command{ + togglePauseRecordingCmd = &coral.Command{ Use: "toggle", Short: "Pause/resume recording", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *coral.Command, args []string) error { return pauseResumeRecording() }, } - recordingStatusCmd = &cobra.Command{ + recordingStatusCmd = &coral.Command{ Use: "status", Short: "Reports recording status", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *coral.Command, args []string) error { return recordingStatus() }, } diff --git a/replaybuffer.go b/replaybuffer.go index 8004473..edacc22 100644 --- a/replaybuffer.go +++ b/replaybuffer.go @@ -4,45 +4,45 @@ import ( "fmt" "strconv" - "github.com/spf13/cobra" + "github.com/muesli/coral" ) var ( - replayBufferCmd = &cobra.Command{ + replayBufferCmd = &coral.Command{ Use: "replaybuffer", Short: "manage replay buffer", Long: `The replaybuffer command manages the replay buffer`, RunE: nil, } - startReplayBufferCmd = &cobra.Command{ + startReplayBufferCmd = &coral.Command{ Use: "start", Short: "Starts replay buffer", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *coral.Command, args []string) error { return startReplayBuffer() }, } - stopReplayBufferCmd = &cobra.Command{ + stopReplayBufferCmd = &coral.Command{ Use: "stop", Short: "Stops replay buffer", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *coral.Command, args []string) error { return stopReplayBuffer() }, } - saveReplayBufferCmd = &cobra.Command{ + saveReplayBufferCmd = &coral.Command{ Use: "save", Short: "Saves replay buffer", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *coral.Command, args []string) error { return saveReplayBuffer() }, } - replayBufferStatusCmd = &cobra.Command{ + replayBufferStatusCmd = &coral.Command{ Use: "status", Short: "Reports replay buffer status", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *coral.Command, args []string) error { return replayBufferStatus() }, } @@ -7,21 +7,21 @@ import ( "github.com/andreykaipov/goobs/api/requests/scenes" studiomode "github.com/andreykaipov/goobs/api/requests/studio_mode" - "github.com/spf13/cobra" + "github.com/muesli/coral" ) var ( - sceneCmd = &cobra.Command{ + sceneCmd = &coral.Command{ Use: "scene", Short: "manage scenes", Long: `The scene command manages scenes`, RunE: nil, } - currentSceneCmd = &cobra.Command{ + currentSceneCmd = &coral.Command{ Use: "current", Short: "Switch program to a different scene", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *coral.Command, args []string) error { if len(args) < 1 { return errors.New("current requires a scene name as argument") } @@ -29,26 +29,26 @@ var ( }, } - listSceneCmd = &cobra.Command{ + listSceneCmd = &coral.Command{ Use: "list", Short: "List all scene names", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *coral.Command, args []string) error { return listScenes() }, } - getSceneCmd = &cobra.Command{ + getSceneCmd = &coral.Command{ Use: "get", Short: "Get the current scene", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *coral.Command, args []string) error { return getScene() }, } - previewSceneCmd = &cobra.Command{ + previewSceneCmd = &coral.Command{ Use: "preview", Short: "Switch preview to a different scene (studio mode must be enabled)", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *coral.Command, args []string) error { if len(args) < 1 { return errors.New("preview requires a scene name as argument") } @@ -56,10 +56,10 @@ var ( }, } - switchSceneCmd = &cobra.Command{ + switchSceneCmd = &coral.Command{ Use: "switch", Short: "Switch program or preview in studio mode to a different scene", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *coral.Command, args []string) error { if len(args) < 1 { return errors.New("switch requires a scene name as argument") } diff --git a/scenecollection.go b/scenecollection.go index 0f81386..547939f 100644 --- a/scenecollection.go +++ b/scenecollection.go @@ -6,37 +6,37 @@ import ( "strings" scenecollections "github.com/andreykaipov/goobs/api/requests/scene_collections" - "github.com/spf13/cobra" + "github.com/muesli/coral" ) var ( - sceneCollectionCmd = &cobra.Command{ + sceneCollectionCmd = &coral.Command{ Use: "scenecollection", Short: "manage scene collections", Long: `The scenecollection command manages scene collections`, RunE: nil, } - listSceneCollectionCmd = &cobra.Command{ + listSceneCollectionCmd = &coral.Command{ Use: "list", Short: "List all scene collections", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *coral.Command, args []string) error { return listSceneCollections() }, } - getSceneCollectionCmd = &cobra.Command{ + getSceneCollectionCmd = &coral.Command{ Use: "get", Short: "Get the current scene collection", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *coral.Command, args []string) error { return getSceneCollection() }, } - setSceneCollectionCmd = &cobra.Command{ + setSceneCollectionCmd = &coral.Command{ Use: "set", Short: "Set the current scene collection", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *coral.Command, args []string) error { if len(args) < 1 { return errors.New("set requires a scene collection name as argument") } diff --git a/sceneitems.go b/sceneitems.go index 3b82e49..cc6d676 100644 --- a/sceneitems.go +++ b/sceneitems.go @@ -6,21 +6,21 @@ import ( sceneitems "github.com/andreykaipov/goobs/api/requests/scene_items" "github.com/andreykaipov/goobs/api/typedefs" - "github.com/spf13/cobra" + "github.com/muesli/coral" ) var ( - sceneItemCmd = &cobra.Command{ + sceneItemCmd = &coral.Command{ Use: "sceneitem", Short: "manage scene items", Long: `The sceneitem command manages a scene's items`, RunE: nil, } - listSceneItemsCmd = &cobra.Command{ + listSceneItemsCmd = &coral.Command{ Use: "list", Short: "Lists all items of a scene", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *coral.Command, args []string) error { if len(args) < 1 { return errors.New("list requires a scene") } @@ -28,10 +28,10 @@ var ( }, } - toggleSceneItemCmd = &cobra.Command{ + toggleSceneItemCmd = &coral.Command{ Use: "toggle", Short: "Toggles visibility of a scene-item", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *coral.Command, args []string) error { if len(args) < 2 { return errors.New("toggle requires a scene and scene-item") } @@ -39,10 +39,10 @@ var ( }, } - showSceneItemCmd = &cobra.Command{ + showSceneItemCmd = &coral.Command{ Use: "show", Short: "Makes a scene-item visible", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *coral.Command, args []string) error { if len(args) < 2 { return errors.New("show requires a scene and scene-item(s)") } @@ -50,10 +50,10 @@ var ( }, } - hideSceneItemCmd = &cobra.Command{ + hideSceneItemCmd = &coral.Command{ Use: "hide", Short: "Hides a scene-item", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *coral.Command, args []string) error { if len(args) < 2 { return errors.New("hide requires a scene and scene-item(s)") } @@ -61,10 +61,10 @@ var ( }, } - getSceneItemVisibilityCmd = &cobra.Command{ + getSceneItemVisibilityCmd = &coral.Command{ Use: "visible", Short: "Show visibility status of a scene-item", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *coral.Command, args []string) error { if len(args) < 2 { return errors.New("visible requires a scene and scene-item") } @@ -72,10 +72,10 @@ var ( }, } - centerSceneItemCmd = &cobra.Command{ + centerSceneItemCmd = &coral.Command{ Use: "center", Short: "Horizontally centers a scene-item", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *coral.Command, args []string) error { if len(args) < 2 { return errors.New("center requires a scene and scene-item") } @@ -5,29 +5,29 @@ import ( "fmt" "github.com/andreykaipov/goobs/api/requests/sources" - "github.com/spf13/cobra" + "github.com/muesli/coral" ) var ( - sourceCmd = &cobra.Command{ + sourceCmd = &coral.Command{ Use: "source", Short: "manage sources", Long: `The source command manages sources`, RunE: nil, } - listSourcesCmd = &cobra.Command{ + listSourcesCmd = &coral.Command{ Use: "list", Short: "Lists all sources", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *coral.Command, args []string) error { return listSources() }, } - toggleMuteCmd = &cobra.Command{ + toggleMuteCmd = &coral.Command{ Use: "toggle-mute", Short: "Toggles mute", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *coral.Command, args []string) error { if len(args) < 1 { return errors.New("toggle-mute requires a source name as argument") } @@ -5,45 +5,45 @@ import ( "strconv" "github.com/andreykaipov/goobs/api/requests/streaming" - "github.com/spf13/cobra" + "github.com/muesli/coral" ) var ( - streamCmd = &cobra.Command{ + streamCmd = &coral.Command{ Use: "stream", Short: "manage streams", Long: `The stream command manages streams`, RunE: nil, } - startStopStreamCmd = &cobra.Command{ + startStopStreamCmd = &coral.Command{ Use: "toggle", Short: "Toggle streaming", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *coral.Command, args []string) error { return startStopStream() }, } - startStreamCmd = &cobra.Command{ + startStreamCmd = &coral.Command{ Use: "start", Short: "Starts streaming", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *coral.Command, args []string) error { return startStream() }, } - stopStreamCmd = &cobra.Command{ + stopStreamCmd = &coral.Command{ Use: "stop", Short: "Stops streaming", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *coral.Command, args []string) error { return stopStream() }, } - streamStatusCmd = &cobra.Command{ + streamStatusCmd = &coral.Command{ Use: "status", Short: "Reports streaming status", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *coral.Command, args []string) error { return streamStatus() }, } diff --git a/studiomode.go b/studiomode.go index 410b16a..9d07cd3 100644 --- a/studiomode.go +++ b/studiomode.go @@ -5,53 +5,53 @@ import ( "strconv" studiomode "github.com/andreykaipov/goobs/api/requests/studio_mode" - "github.com/spf13/cobra" + "github.com/muesli/coral" ) var ( - studioModeCmd = &cobra.Command{ + studioModeCmd = &coral.Command{ Use: "studiomode", Short: "manage studio mode", Long: `The studiomode command manages the studio mode`, RunE: nil, } - disableStudioModeCmd = &cobra.Command{ + disableStudioModeCmd = &coral.Command{ Use: "disable", Short: "Disables the studio mode", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *coral.Command, args []string) error { return disableStudioMode() }, } - enableStudioModeCmd = &cobra.Command{ + enableStudioModeCmd = &coral.Command{ Use: "enable", Short: "Enables the studio mode", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *coral.Command, args []string) error { return enableStudioMode() }, } - studioModeStatusCmd = &cobra.Command{ + studioModeStatusCmd = &coral.Command{ Use: "status", Short: "Reports studio mode status", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *coral.Command, args []string) error { return studioModeStatus() }, } - toggleStudioModeCmd = &cobra.Command{ + toggleStudioModeCmd = &coral.Command{ Use: "toggle", Short: "Toggles the studio mode (enable/disable)", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *coral.Command, args []string) error { return toggleStudioMode() }, } - transitionToProgramCmd = &cobra.Command{ + transitionToProgramCmd = &coral.Command{ Use: "transition", Short: "Transition to program", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *coral.Command, args []string) error { return transitionToProgram() }, } diff --git a/virtualcam.go b/virtualcam.go index a8ee6b7..8dc0d2f 100644 --- a/virtualcam.go +++ b/virtualcam.go @@ -4,45 +4,45 @@ import ( "fmt" "strconv" - "github.com/spf13/cobra" + "github.com/muesli/coral" ) var ( - virtualCamCmd = &cobra.Command{ + virtualCamCmd = &coral.Command{ Use: "virtualcam", Short: "manage virtual camera", Long: `The virtualcam command manages the virtual camera`, RunE: nil, } - startStopVirtualCamCmd = &cobra.Command{ + startStopVirtualCamCmd = &coral.Command{ Use: "toggle", Short: "Toggle virtual camera status", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *coral.Command, args []string) error { return starStopVirtualCam() }, } - startVirtualCamCmd = &cobra.Command{ + startVirtualCamCmd = &coral.Command{ Use: "start", Short: "Starts virtual camera", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *coral.Command, args []string) error { return startVirtualCam() }, } - stopVirtualCamCmd = &cobra.Command{ + stopVirtualCamCmd = &coral.Command{ Use: "stop", Short: "Stops virtual camera", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *coral.Command, args []string) error { return stopVirtualCam() }, } - virtualCamStatusCmd = &cobra.Command{ + virtualCamStatusCmd = &coral.Command{ Use: "status", Short: "Reports virtual camera status", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *coral.Command, args []string) error { return virtualCamStatus() }, } |