Skip to content

Commit

Permalink
chore: move lowest level of commands one level up
Browse files Browse the repository at this point in the history
  • Loading branch information
zepatrik authored and aeneasr committed Aug 26, 2020
1 parent f22c58a commit 83c55e9
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 31 deletions.
4 changes: 1 addition & 3 deletions cmd/identities/identities.go
Expand Up @@ -2,8 +2,6 @@ package identities

import (
"github.com/spf13/cobra"

"github.com/ory/kratos/cmd/identities/port"
)

// identitiesCmd represents the identity command
Expand All @@ -14,7 +12,7 @@ var identitiesCmd = &cobra.Command{
func RegisterCommandRecursive(parent *cobra.Command) {
parent.AddCommand(identitiesCmd)

port.RegisterCommandRecursive(identitiesCmd)
identitiesCmd.AddCommand(importCmd)
}

func init() {
Expand Down
6 changes: 1 addition & 5 deletions cmd/identities/port/import.go → cmd/identities/import.go
@@ -1,4 +1,4 @@
package port
package identities

import (
"github.com/spf13/cobra"
Expand All @@ -11,7 +11,3 @@ var importCmd = &cobra.Command{
Use: "import <file.json [file-2.json [file-3.json] ...]>",
Run: client.NewIdentityClient().Import,
}

func RegisterCommandRecursive(parent *cobra.Command) {
parent.AddCommand(importCmd)
}
6 changes: 1 addition & 5 deletions cmd/jsonnet/format/format.go → cmd/jsonnet/format.go
Expand Up @@ -13,7 +13,7 @@ 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 format
package jsonnet

import (
"fmt"
Expand Down Expand Up @@ -62,10 +62,6 @@ Use -w or --write to write output back to files instead of stdout.
},
}

func RegisterCommandRecursive(parent *cobra.Command) {
parent.AddCommand(jsonnetFormatCmd)
}

func init() {
jsonnetFormatCmd.Flags().BoolP("write", "w", false, "Write formatted output back to file.")
}
7 changes: 2 additions & 5 deletions cmd/jsonnet/jsonnet.go
Expand Up @@ -2,9 +2,6 @@ package jsonnet

import (
"github.com/spf13/cobra"

"github.com/ory/kratos/cmd/jsonnet/format"
"github.com/ory/kratos/cmd/jsonnet/lint"
)

// jsonnetCmd represents the jsonnet command
Expand All @@ -16,6 +13,6 @@ var jsonnetCmd = &cobra.Command{
func RegisterCommandRecursive(parent *cobra.Command) {
parent.AddCommand(jsonnetCmd)

format.RegisterCommandRecursive(jsonnetCmd)
lint.RegisterCommandRecursive(jsonnetCmd)
jsonnetCmd.AddCommand(jsonnetFormatCmd)
jsonnetCmd.AddCommand(jsonnetLintCmd)
}
6 changes: 1 addition & 5 deletions cmd/jsonnet/lint/lint.go → cmd/jsonnet/lint.go
@@ -1,4 +1,4 @@
package lint
package jsonnet

import (
"fmt"
Expand Down Expand Up @@ -44,7 +44,3 @@ var jsonnetLintCmd = &cobra.Command{
}
},
}

func RegisterCommandRecursive(parent *cobra.Command) {
parent.AddCommand(jsonnetLintCmd)
}
4 changes: 1 addition & 3 deletions cmd/migrate/migrate.go
Expand Up @@ -2,8 +2,6 @@ package migrate

import (
"github.com/spf13/cobra"

"github.com/ory/kratos/cmd/migrate/sql"
)

// migrateCmd represents the migrate command
Expand All @@ -15,5 +13,5 @@ var migrateCmd = &cobra.Command{
func RegisterCommandRecursive(parent *cobra.Command) {
parent.AddCommand(migrateCmd)

sql.RegisterCommandRecursive(migrateCmd)
migrateCmd.AddCommand(migrateSqlCmd)
}
6 changes: 1 addition & 5 deletions cmd/migrate/sql/migrate_sql.go → cmd/migrate/sql.go
Expand Up @@ -13,7 +13,7 @@ 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 sql
package migrate

import (
"github.com/spf13/cobra"
Expand Down Expand Up @@ -52,10 +52,6 @@ Before running this command on an existing database, create a back up!
},
}

func RegisterCommandRecursive(parent *cobra.Command) {
parent.AddCommand(migrateSqlCmd)
}

func init() {
migrateSqlCmd.Flags().BoolP("read-from-env", "e", false, "If set, reads the database connection string from the environment variable DSN or config file key dsn.")
migrateSqlCmd.Flags().BoolP("yes", "y", false, "If set all confirmation requests are accepted without user interaction.")
Expand Down

0 comments on commit 83c55e9

Please sign in to comment.