Skip to content
This repository has been archived by the owner on Nov 18, 2021. It is now read-only.

Commit

Permalink
cmd/cue/cmd: add get to define CUE package from Go
Browse files Browse the repository at this point in the history
Update #24

Change-Id: Ief47b7295249354d5eafbe0bcf33ea26dd6dfdc7
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/1723
Reviewed-by: Marcel van Lohuizen <[email protected]>
  • Loading branch information
mpvl committed Apr 19, 2019
1 parent e9fd214 commit 412e5ff
Show file tree
Hide file tree
Showing 16 changed files with 1,608 additions and 10 deletions.
2 changes: 1 addition & 1 deletion cmd/cue/cmd/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ func runCommand(t *testing.T, f func(cmd *cobra.Command, args []string) error, n
if err != nil {
log.Fatal(err)
}

const dir = "./testdata"

filepath.Walk(dir, func(path string, info os.FileInfo, err error) error {
t.Run(path, func(t *testing.T) {
if err != nil {
Expand Down
45 changes: 45 additions & 0 deletions cmd/cue/cmd/get.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Copyright 2018 The CUE 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 cmd

import (
"fmt"

"github.com/spf13/cobra"
)

// getCmd represents the extract command
var getCmd = &cobra.Command{
Use: "get <language> [packages]",
Short: "add dependencies to the current module",
Long: `Get downloads packages or modules for CUE or another language
to include them in the module's pkg directory.
Get requires an additional language field to determine for which
language definitions should be fetched. If get fetches definitions
for a language other than CUE, the definitions are extracted from
the source of the respective language and stored.
The specifics on how dependencies are fechted and converted vary
per language and are documented in the respective subcommands.
`,
RunE: func(cmd *cobra.Command, args []string) error {
fmt.Println("get must be run as one of its subcommands")
return nil
},
}

func init() {
rootCmd.AddCommand(getCmd)
}
Loading

0 comments on commit 412e5ff

Please sign in to comment.