Skip to content

Commit

Permalink
Clean up the kn sub-package
Browse files Browse the repository at this point in the history
  • Loading branch information
cardil committed Mar 7, 2024
1 parent f170971 commit e01393a
Show file tree
Hide file tree
Showing 27 changed files with 45 additions and 75 deletions.
File renamed without changes.
File renamed without changes.
Expand Up @@ -20,8 +20,8 @@ import (
"github.com/spf13/cobra"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/cli-runtime/pkg/genericclioptions"
"knative.dev/client-pkg/pkg/commands"

"knative.dev/client-pkg/pkg/kn/commands"
hprinters "knative.dev/client-pkg/pkg/printers"
"knative.dev/client-pkg/pkg/util"
)
Expand Down
File renamed without changes.
Expand Up @@ -22,11 +22,11 @@ import (
"github.com/spf13/cobra"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
"knative.dev/client-pkg/pkg/config"
"knative.dev/pkg/apis"
duckv1 "knative.dev/pkg/apis/duck/v1"

clientdynamic "knative.dev/client-pkg/pkg/dynamic"
"knative.dev/client-pkg/pkg/kn/config"
)

type SinkFlags struct {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Expand Up @@ -18,13 +18,13 @@ import (
"bytes"

"knative.dev/client-pkg/pkg/dynamic/fake"
"knative.dev/client-pkg/pkg/flags"

"github.com/spf13/cobra"
"k8s.io/apimachinery/pkg/runtime"
clienttesting "k8s.io/client-go/testing"
servingv1fake "knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1/fake"

"knative.dev/client-pkg/pkg/kn/flags"
clientservingv1 "knative.dev/client-pkg/pkg/serving/v1"
v1 "knative.dev/client-pkg/pkg/sources/v1"

Expand Down
File renamed without changes.
File renamed without changes.
30 changes: 16 additions & 14 deletions pkg/kn/config/config.go → pkg/config/config.go
@@ -1,16 +1,18 @@
// Copyright © 2020 The Knative Authors
//
// 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.
/*
Copyright 2024 The Knative Authors
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 config

Expand All @@ -21,7 +23,7 @@ import (
"path/filepath"
"runtime"

homedir "github.com/mitchellh/go-homedir"
"github.com/mitchellh/go-homedir"
flag "github.com/spf13/pflag"
"github.com/spf13/viper"
)
Expand Down
30 changes: 16 additions & 14 deletions pkg/kn/config/config_test.go → pkg/config/config_test.go
@@ -1,16 +1,18 @@
// Copyright © 2020 The Knative Authors
//
// 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.
/*
Copyright 2024 The Knative Authors
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 config

Expand All @@ -19,7 +21,7 @@ import (
"path/filepath"
"testing"

homedir "github.com/mitchellh/go-homedir"
"github.com/mitchellh/go-homedir"
"github.com/spf13/viper"
"gotest.tools/v3/assert"
)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 2 additions & 3 deletions pkg/kn-source-pkg/pkg/factories/flags_factory.go
Expand Up @@ -15,10 +15,9 @@
package factories

import (
"knative.dev/client-pkg/pkg/kn-source-pkg/pkg/types"
"knative.dev/client-pkg/pkg/kn/commands"

"github.com/spf13/pflag"
"knative.dev/client-pkg/pkg/commands"
"knative.dev/client-pkg/pkg/kn-source-pkg/pkg/types"
)

type DefautFlagsFactory struct {
Expand Down
3 changes: 1 addition & 2 deletions pkg/kn-source-pkg/pkg/factories/kn_source_factory.go
Expand Up @@ -16,10 +16,9 @@ package factories

import (
"k8s.io/client-go/rest"
"knative.dev/client-pkg/pkg/commands/flags"
"knative.dev/client-pkg/pkg/kn-source-pkg/pkg/client"
"knative.dev/client-pkg/pkg/kn-source-pkg/pkg/types"

"knative.dev/client-pkg/pkg/kn/commands/flags"
)

type DefautKnSourceFactory struct {
Expand Down
3 changes: 1 addition & 2 deletions pkg/kn-source-pkg/pkg/factories/kn_source_factory_test.go
Expand Up @@ -19,9 +19,8 @@ import (

"gotest.tools/v3/assert"
"k8s.io/client-go/rest"
"knative.dev/client-pkg/pkg/commands/flags"
"knative.dev/client-pkg/pkg/kn-source-pkg/pkg/types"
"knative.dev/client-pkg/pkg/kn/commands/flags"

"knative.dev/client-pkg/pkg/kn-source-pkg/pkg/types/typesfakes"
)

Expand Down
8 changes: 4 additions & 4 deletions pkg/kn-source-pkg/pkg/types/structs.go
Expand Up @@ -18,18 +18,18 @@ package types

import (
"github.com/spf13/cobra"
"knative.dev/client-pkg/pkg/kn/commands"
"knative.dev/client-pkg/pkg/kn/commands/flags"
commands2 "knative.dev/client-pkg/pkg/commands"
"knative.dev/client-pkg/pkg/commands/flags"
)

type KnSourceParams struct {
commands.KnParams
commands2.KnParams

SinkFlag flags.SinkFlags
}

func (p *KnSourceParams) AddCommonFlags(cmd *cobra.Command) {
commands.AddNamespaceFlags(cmd.Flags(), true)
commands2.AddNamespaceFlags(cmd.Flags(), true)
}

func (p *KnSourceParams) AddCreateUpdateFlags(cmd *cobra.Command) {
Expand Down
3 changes: 1 addition & 2 deletions pkg/kn-source-pkg/pkg/types/structs_test.go
Expand Up @@ -19,8 +19,7 @@ import (

"github.com/spf13/cobra"
"gotest.tools/v3/assert"

"knative.dev/client-pkg/pkg/kn/commands/flags"
"knative.dev/client-pkg/pkg/commands/flags"
)

func TestAddCommonFlags(t *testing.T) {
Expand Down
30 changes: 0 additions & 30 deletions pkg/kn/plugin/types.go

This file was deleted.

2 changes: 1 addition & 1 deletion pkg/serving/config_changes.go
Expand Up @@ -22,7 +22,7 @@ import (
"strings"
"time"

"knative.dev/client-pkg/pkg/kn/flags"
"knative.dev/client-pkg/pkg/flags"
"knative.dev/pkg/ptr"
"knative.dev/serving/pkg/apis/autoscaling"
servingconfig "knative.dev/serving/pkg/apis/config"
Expand Down

0 comments on commit e01393a

Please sign in to comment.