Skip to content
This repository was archived by the owner on Sep 28, 2021. It is now read-only.

Support for global contexts - #362

Merged
glooms merged 53 commits into
masterfrom
context
Aug 21, 2019
Merged

glooms merged 53 commits into
masterfrom
context

Conversation

@glooms

@glooms glooms commented Jul 17, 2019 •

Copy link
Copy Markdown
Contributor

This PR adds the ability to use global contexts.

Specifically adds the subcommand context with the commands set, rm, ls, get, clear to work with contexts. List of the commands:

  • set is used to create new contexts or update existing ones.

  • rm removes the specified context

  • ls lists the available contexts while marking which is the currently used.

  • get returns a more exhaustive representation of a context. Current context if nothing else is specified.

  • clear sets the current context to an empty string.

Any command that changes the current context will inform the user by printing: Context: <current-context>

Furthermore, the precedence will be: cli-flags > config > context.

Closes #315

@wennmo wennmo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall! This is definitely something we should try to get in soon.

Comment thread internal/context.go Resolved
Comment thread internal/context.go Resolved
Comment thread docs/spec.json Resolved
Comment thread docs/spec.json Resolved
Comment thread cmd/context.go Resolved
Comment thread cmd/context.go Resolved
Comment thread cmd/flags.go Outdated
globalFlags.Bool("no-data", false, "Open app without data")
globalFlags.Bool("bash", false, "Bash flag used to adapt output to bash completion format")
globalFlags.MarkHidden("bash")
globalFlags.String("context", "", "Specific context that should be used when connecting")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

=> "Name of context to use when connecting to the Qlik Associative Engine" or something similar?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to more descriptive text similar to that of engine url.

Comment thread printer/contexts.go Resolved
Comment thread cmd/context.go Resolved
Comment thread cmd/context.go Resolved
Comment thread cmd/context.go Resolved
Comment thread printer/contexts.go Resolved
Comment thread internal/context.go Resolved
Comment thread internal/context.go Outdated
context = handler.GetCurrent()
}
updated := context.Update(&map[string]interface{}{
"engine": viper.GetString("engine"),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

engine == wsURL?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As engine is the name of the flag and used similarly in config it seems like the best name here as well.

@glooms
glooms merged commit 9a19ba9 into master Aug 21, 2019
@glooms
glooms deleted the context branch August 21, 2019 09:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for global contexts

4 participants

⌂ 换网址