Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add uuidgen command to refresh manifest identifier
- Loading branch information
1 parent
97230fa
commit 020eecf
Showing
2 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package cmd | ||
|
||
import ( | ||
"os" | ||
|
||
"github.com/pokanop/nostromo/task" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
// uuidgenCmd represents the uuidgen command | ||
var uuidgenCmd = &cobra.Command{ | ||
Use: "uuidgen [name]", | ||
Short: "Generate a new unique id for a manifest", | ||
Long: `Generate a new unique id for a manifest. | ||
nostromo uses a uuid to determine if a manifest is unique or not. | ||
When using sync to get new manifests, nostromo will only apply the | ||
changes if it detects a different identifier. | ||
This command allows regenerating the uuid to allow for publishing | ||
and pulling updated manifests. Note that using standard nostromo | ||
commands automatically updates the identifier. This command can be | ||
used if manual updates were made to a manifest. | ||
Omitting the name of the manifest will apply to the core manifest.`, | ||
Args: cobra.MaximumNArgs(1), | ||
Run: func(cmd *cobra.Command, args []string) { | ||
var name string | ||
if len(args) > 0 { | ||
name = args[0] | ||
} | ||
os.Exit(task.RegenerateID(name)) | ||
}, | ||
} | ||
|
||
func init() { | ||
rootCmd.AddCommand(uuidgenCmd) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters