-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for creating a collection [cli] #33
Merged
Merged
Conversation
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
StefMa
force-pushed
the
cli-creation-collection
branch
from
August 4, 2023 11:07
8229ef3
to
18c33e6
Compare
rsjethani
requested changes
Aug 4, 2023
rsjethani
requested changes
Aug 5, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apply following changes then we are good to go:
diff --git a/internal/cli/cli.go b/internal/cli/cli.go
index 8d8283f..10e5a04 100644
--- a/internal/cli/cli.go
+++ b/internal/cli/cli.go
@@ -24,7 +24,7 @@ func Run() error {
}
func rootCmd() *cobra.Command {
- var rootCmd = &cobra.Command{Use: "outline"}
+ rootCmd := &cobra.Command{Use: "outline"}
var apiKeyFlag string
var baseUrlFlag string
@@ -45,7 +45,7 @@ func collectionCmd(rootCmd *cobra.Command) *cobra.Command {
fetchSubCmd := collectionCmdFetch(rootCmd)
collectionCmd.AddCommand(fetchSubCmd)
- createSubCmd := collectionCmdCrate(rootCmd)
+ createSubCmd := collectionCmdCreate(rootCmd)
collectionCmd.AddCommand(createSubCmd)
return collectionCmd
@@ -73,7 +73,7 @@ func collectionCmdFetch(rootCmd *cobra.Command) *cobra.Command {
return fmt.Errorf("can't get collection with id '%s': %w", colId, err)
}
- b, err := json.Marshal(&col)
+ b, err := json.Marshal(col)
if err != nil {
return fmt.Errorf("failed marshalling collection with id '%s: %w", colId, err)
}
@@ -84,7 +84,7 @@ func collectionCmdFetch(rootCmd *cobra.Command) *cobra.Command {
}
}
-func collectionCmdCrate(rootCmd *cobra.Command) *cobra.Command {
+func collectionCmdCreate(rootCmd *cobra.Command) *cobra.Command {
return &cobra.Command{
Use: "create",
Short: "Creates a collection",
@@ -107,7 +107,7 @@ func collectionCmdCrate(rootCmd *cobra.Command) *cobra.Command {
return fmt.Errorf("can't create collection with name '%s': %w", name, err)
}
- b, err := json.Marshal(&col)
+ b, err := json.Marshal(col)
if err != nil {
return fmt.Errorf("failed marshalling collection with name '%s: %w", name, err)
}
StefMa
force-pushed
the
cli-creation-collection
branch
from
August 5, 2023 17:34
34838fe
to
e5f9e64
Compare
Applied the changes here and rebased with |
rsjethani
approved these changes
Aug 6, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #14
This is just a basic usage of creating a collection.
The only supported option is the required "name".
Optional stuff will be added later.
Reference #29
You can check our internal outline instace for the collection named "stefmaTest".
This was done via the API:
You could also check this via the CLI 🤓