Skip to content

Commit

Permalink
Merge branch 'main' into cli-run
Browse files Browse the repository at this point in the history
  • Loading branch information
raulb authored Dec 20, 2024
2 parents e4a793b + 3268d78 commit 07cc26f
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cmd/conduit/root/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"github.com/conduitio/conduit/cmd/conduit/root/config"
"github.com/conduitio/conduit/cmd/conduit/root/initialize"
"github.com/conduitio/conduit/cmd/conduit/root/pipelines"
"github.com/conduitio/conduit/cmd/conduit/root/run"
"github.com/conduitio/conduit/cmd/conduit/root/version"
"github.com/conduitio/conduit/pkg/conduit"
"github.com/conduitio/ecdysis"
)
Expand All @@ -35,7 +35,8 @@ var (
)

type RootFlags struct {
Version bool `long:"version" short:"v" usage:"show current Conduit version"`
Version bool `long:"version" short:"v" usage:"show the current Conduit version"`
conduit.Config
}

type RootCommand struct {
Expand Down Expand Up @@ -74,6 +75,7 @@ func (c *RootCommand) SubCommands() []ecdysis.Command {
return []ecdysis.Command{
&config.ConfigCommand{RunCmd: runCmd},
&initialize.InitCommand{Cfg: &runCmd.Cfg},
&version.VersionCommand{},
&pipelines.PipelinesCommand{},
&run.RunCommand{},

Check failure on line 80 in cmd/conduit/root/root.go

View workflow job for this annotation

GitHub Actions / golangci-lint

undefined: run (typecheck)
}
Expand Down
44 changes: 44 additions & 0 deletions cmd/conduit/root/version/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// Copyright © 2024 Meroxa, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package version

import (
"context"
"fmt"
"os"

"github.com/conduitio/conduit/pkg/conduit"
"github.com/conduitio/ecdysis"
)

var (
_ ecdysis.CommandWithExecute = (*VersionCommand)(nil)
_ ecdysis.CommandWithDocs = (*VersionCommand)(nil)
)

type VersionCommand struct{}

func (c *VersionCommand) Usage() string { return "version" }

func (c *VersionCommand) Execute(_ context.Context) error {
_, _ = fmt.Fprintf(os.Stdout, "%s\n", conduit.Version(true))
return nil
}

func (c *VersionCommand) Docs() ecdysis.Docs {
return ecdysis.Docs{
Short: "Show the current version of Conduit.",
}
}

0 comments on commit 07cc26f

Please sign in to comment.