Skip to content

Commit 0459513

Browse files
rkpattnaik780wtrocki
authored andcommitted
docs(context): change examples
1 parent be22744 commit 0459513

File tree

12 files changed

+58
-31
lines changed

12 files changed

+58
-31
lines changed

docs/commands/rhoas.md

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/commands/rhoas_context.md

Lines changed: 7 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/commands/rhoas_context_kafka-use.md

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/commands/rhoas_context_service-registry-use.md

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/commands/rhoas_context_status.md

Lines changed: 7 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/commands/rhoas_kafka_use.md

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/commands/rhoas_status.md

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/cmd/context/context.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
package context
22

33
import (
4+
"path/filepath"
5+
46
"github.com/redhat-developer/app-services-cli/pkg/cmd/context/create"
57
"github.com/redhat-developer/app-services-cli/pkg/cmd/context/delete"
68
"github.com/redhat-developer/app-services-cli/pkg/cmd/context/list"
79
"github.com/redhat-developer/app-services-cli/pkg/cmd/context/use"
810
kafkaUse "github.com/redhat-developer/app-services-cli/pkg/cmd/kafka/use"
911
registryUse "github.com/redhat-developer/app-services-cli/pkg/cmd/registry/use"
12+
"github.com/redhat-developer/app-services-cli/pkg/core/localize"
13+
"github.com/redhat-developer/app-services-cli/pkg/core/servicecontext"
1014

1115
"github.com/redhat-developer/app-services-cli/pkg/cmd/status"
1216
"github.com/redhat-developer/app-services-cli/pkg/shared/factory"
@@ -15,10 +19,15 @@ import (
1519

1620
// NewContextCmd creates a new command to manage service contexts
1721
func NewContextCmd(f *factory.Factory) *cobra.Command {
22+
23+
ctxDirLocation, _ := servicecontext.DefaultDir()
24+
25+
ctxLocation := filepath.Join(ctxDirLocation, "contexts.json")
26+
1827
cmd := &cobra.Command{
1928
Use: "context",
2029
Short: f.Localizer.MustLocalize("context.cmd.shortDescription"),
21-
Long: f.Localizer.MustLocalize("context.cmd.longDescription"),
30+
Long: f.Localizer.MustLocalize("context.cmd.longDescription", localize.NewEntry("ContextPath", ctxLocation)),
2231
Example: f.Localizer.MustLocalize("context.cmd.example"),
2332
Args: cobra.NoArgs,
2433
}

pkg/core/localize/locales/en/cmd/context.en.toml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ rhoas context commands allow developers to:
99
* Manage different service contexts by switching, listing and removing service contexts
1010
* Share context with others to use the same set of services
1111
* Generating configuration for connecting to the services from various platforms and tools
12+
13+
The loading order of contexts follows these rules:
14+
15+
1. If $RHOAS_CONTEXT environment variable is set, then contexts are managed using only that file
16+
2. Otherwise, "UserConfigDir/rhoas/contexts.json" is used for contexts
17+
1218
'''
1319

1420
[context.cmd.example]
@@ -52,10 +58,13 @@ Print overview of the services in associated with a service context
5258

5359
[context.status.cmd.example]
5460
one='''
55-
# View the status of all application services
61+
# View the status of all application services in the current service context
5662
$ rhoas context status
5763
58-
# View the status of the Kafka instance set in the current context
64+
# View the status of all application services in a specific service context
65+
$ rhoas context status --name my-context
66+
67+
# View the status of the Kafka instance set in the current service context
5968
$ rhoas context status kafka
6069
6170
# View the status of your services in JSON format
@@ -65,19 +74,19 @@ $ rhoas context status -o json
6574
[context.kafkaUse.cmd.example]
6675
description = 'Examples of how to use the command'
6776
one = '''
68-
# Select a Kafka instance to be set in the current context
77+
# Select a Kafka instance by name to be set in the current context
6978
$ rhoas context kafka-use --name=my-kafka
7079
71-
# Select a Kafka instance to be set in the current context
80+
# Select a Kafka instance by ID to be set in the current context
7281
$ rhoas context kafka-use --id=1iSY6RQ3JKI8Q0OTmjQFd3ocFRg
7382
'''
7483

7584
[context.registryUse.cmd.example]
7685
one = '''
77-
# Use a Service Registry instance by name
86+
# Select a Service Registry instance by name to be set in the current context
7887
rhoas context service-registry-use --name my-service-registry
7988
80-
# Use a Service Registry instance by ID
89+
# Select a Service Registry instance by ID to be set in the current context
8190
rhoas context service-registry-use --id 1iSY6RQ3JKI8Q0OTmjQFd3ocFRg
8291
'''
8392

pkg/core/localize/locales/en/cmd/kafka.en.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -780,10 +780,10 @@ You can select a Kafka instance by name or ID.
780780
[kafka.use.cmd.example]
781781
description = 'Examples of how to use the command'
782782
one = '''
783-
# Select a Kafka instance to be the current instance
783+
# Select a Kafka instance by name to be set in the current context
784784
$ rhoas kafka use --name=my-kafka
785785
786-
# Select a Kafka instance to be the current instance
786+
# Select a Kafka instance by ID to be set in the current context
787787
$ rhoas kafka use --id=1iSY6RQ3JKI8Q0OTmjQFd3ocFRg
788788
'''
789789

0 commit comments

Comments
 (0)