@@ -6,102 +6,15 @@ import (
66
77 "github.com/spf13/cobra"
88
9- "github.com/hofstadter-io/hof/cmd/hof/cmd/mod"
10-
119 "github.com/hofstadter-io/hof/cmd/hof/ga"
1210)
1311
14- var modLong = `hof mod is CUE dependency management based on Go mods.
15-
16- ### Module File
17-
18- The module file holds the requirements for project.
19- It is found in cue.mod/module.cue
20-
21- ---
22- // These are like golang import paths
23- // i.e. github.com/hofstadter-io/hof
24- module: "<module-path>"
25- cue: "v0.5.0"
26-
27- // Required dependencies section
28- require: {
29- // "<module-path>": "<module-semver>"
30- "github.com/hofstadter-io/ghacue": "v0.2.0"
31- "github.com/hofstadter-io/hofmod-cli": "v0.8.1"
32- }
33-
34- // Indirect dependencies (managed by hof)
35- indirect: { ... }
36-
37- // Replace dependencies with local or remote
38- replace: {
39- "github.com/hofstadter-io/ghacue": "github.com/myorg/ghacue": "v0.4.2"
40- "github.com/hofstadter-io/hofmod-cli": "../mods/clie"
41- }
42- ---
43-
44-
45- ### Authentication and private modules
46-
47- hof mod prefers authenticated requests when fetching dependencies.
48- This increase rate limits with hosts and supports private modules.
49- Both token and sshkey base methods are supported, with preferences:
50-
51- 1. Matching entry in .netrc
52- machine github.com
53- login github-token
54- password <github-token-value>
55-
56- 2. ENV VARS for well known hosts.
57-
58- GITHUB_TOKEN
59- GITLAB_TOKEN
60- BITBUCKET_USERNAME / BITBUCKET_PASSWORD or BITBUCKET_TOKEN
61-
62- The bitbucket method will depend on the account type and enterprise license.
12+ var modLong = `CUE module dependency management, imported from upstream CUE project`
6313
64- 3. SSH keys
14+ func ModRun ( args [] string ) ( err error ) {
6515
66- the following are searched: ~/.ssh/config, /etc/ssh/config, ~/.ssh/id_rsa
67-
68-
69- ### Usage
70-
71- there are two main commands you will use, init & tidy
72-
73- # Initialize the current folder as a module
74- hof mod init <module-path> (like github.com/org/repo)
75-
76- # Refresh dependencies, discovering any new imports
77- hof mod tidy
78-
79- # Add a dependency
80- hof mod get github.com/hofstadter-io/[email protected] 81- hof mod get github.com/hofstadter-io/[email protected] 82- hof mod get github.com/hofstadter-io/hof@latest // latest semver
83- hof mod get github.com/hofstadter-io/hof@next // next prerelease
84- hof mod get github.com/hofstadter-io/hof@main // latest commit on branch
85-
86- # Update dependencies
87- hof mod get github.com/hofstadter-io/hof@latest
88- hof mod get all@latest
89-
90- # Symlink dependencies from local cache
91- hof mod link
92-
93- # Copy dependency code from local cache
94- hof mod vendor
95-
96- # Verify dependency code against cue.mod/sums.cue
97- hof mod verify
98-
99- # This helpful output
100- hof mod help
101-
102- `
103-
104- func ModPersistentPreRun (args []string ) (err error ) {
16+ // you can safely comment this print out
17+ fmt .Println ("not implemented" )
10518
10619 return err
10720}
@@ -118,12 +31,15 @@ var ModCmd = &cobra.Command{
11831
11932 Long : modLong ,
12033
121- PersistentPreRun : func (cmd * cobra.Command , args []string ) {
34+ Run : func (cmd * cobra.Command , args []string ) {
35+
36+ ga .SendCommandPath (cmd .CommandPath ())
37+
12238 var err error
12339
12440 // Argument Parsing
12541
126- err = ModPersistentPreRun (args )
42+ err = ModRun (args )
12743 if err != nil {
12844 fmt .Println (err )
12945 os .Exit (1 )
@@ -165,13 +81,4 @@ func init() {
16581 ModCmd .SetHelpFunc (thelp )
16682 ModCmd .SetUsageFunc (tusage )
16783
168- ModCmd .AddCommand (cmdmod .InitCmd )
169- ModCmd .AddCommand (cmdmod .GetCmd )
170- ModCmd .AddCommand (cmdmod .VerifyCmd )
171- ModCmd .AddCommand (cmdmod .TidyCmd )
172- ModCmd .AddCommand (cmdmod .LinkCmd )
173- ModCmd .AddCommand (cmdmod .VendorCmd )
174- ModCmd .AddCommand (cmdmod .CleanCmd )
175- ModCmd .AddCommand (cmdmod .PublishCmd )
176-
17784}
0 commit comments