Skip to content
This repository has been archived by the owner on Mar 9, 2021. It is now read-only.

[source-kafka] Fix subcommand's long, short, Use values and update docs #65

Merged
merged 1 commit into from
Jul 22, 2020

Conversation

daisy-ycguo
Copy link
Member

Closes #59

@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label Jul 8, 2020
@knative-prow-robot knative-prow-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jul 8, 2020
return sourceCmd
}

func (f *kafkaSourceCommandFactory) CreateCommand() *cobra.Command {
createCmd := f.defaultCommandFactory.CreateCommand()
createCmd.Short = "create NAME"
createCmd.Use = "create NAME"
Copy link
Contributor

Choose a reason for hiding this comment

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

this should represent all the flags which are mandatory for creating a kafka source

(check ping source usage string for example where --sink is a mandatory option)

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed.

describeCmd.Short = "describe NAME"
describeCmd.Long = "update a Kafka source"
describeCmd.Use = "describe NAME"
describeCmd.Short = "update a Kafka source"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
describeCmd.Short = "update a Kafka source"
describeCmd.Short = "Describe a Kafka source"

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed.

deleteCmd.Short = "delete NAME"
deleteCmd.Long = "delete a Kafka source"
deleteCmd.Use = "delete NAME"
deleteCmd.Short = "delete a Kafka source"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
deleteCmd.Short = "delete a Kafka source"
deleteCmd.Short = "Delete a kafka source"

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed.

return sourceCmd
}

func (f *kafkaSourceCommandFactory) CreateCommand() *cobra.Command {
createCmd := f.defaultCommandFactory.CreateCommand()
createCmd.Short = "create NAME"
createCmd.Use = "create NAME"
createCmd.Short = "create a kafka source"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
createCmd.Short = "create a kafka source"
createCmd.Short = "Create a kafka source"

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed.

@knative-prow-robot knative-prow-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jul 9, 2020
return sourceCmd
}

func (f *kafkaSourceCommandFactory) CreateCommand() *cobra.Command {
createCmd := f.defaultCommandFactory.CreateCommand()
createCmd.Short = "create NAME"
createCmd.Use = "create NAME --sink SINK"
createCmd.Short = "Create a kafka source"
createCmd.Example = `#Creates a new Kafka source named as 'mykafkasrc' which subscribes a Kafka server 'my-cluster-kafka-bootstrap.kafka.svc:9092' at topic 'test-topic' using the consumer group ID 'test-consumer-group' and sends the event messages to service 'event-display'
Copy link
Contributor

@chaozbj chaozbj Jul 10, 2020

Choose a reason for hiding this comment

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

Should we add a space between # and the example description? I just found kn command has space between them.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed. Thank you.

@daisy-ycguo daisy-ycguo changed the title Fix subcommand's long, short, Use values and update docs [source-kafka] Fix subcommand's long, short, Use values and update docs Jul 10, 2020
Comment on lines 56 to 58
* [kafka create](#kafka-create) - Create a kafka source
* [kafka delete](#kafka-delete) - Delete a Kafka source
* [kafka describe](#kafka-describe) - Describe a Kafka source
Copy link
Contributor

Choose a reason for hiding this comment

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

inconsistent spell for "kafka", should begin with lower case

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed.


```
kafka create NAME [flags]
kafka create NAME --sink SINK [flags]
Copy link
Contributor

Choose a reason for hiding this comment

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

I think all the flags except sink are required for kafka source creation.

Copy link
Contributor

Choose a reason for hiding this comment

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

also, usage should also include being with kn source, i.e.

kn source kafka create NAME --servers SERVERS --topics TOPICS --consumergroup GROUP [options]

Copy link
Member Author

Choose a reason for hiding this comment

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

I have added all flags to the usage output.
As to add kn source to the usage, it's not easy to fix here. This part of README.md is auto generated by cobra/doc. I could try to change my doc generator tool to add kn source in front of command usage. Let's keep it as it in this PR. I will create a new issue.

```

#### Examples

```
#Creates a new Kafka source named as 'mykafkasrc' which subscribes a Kafka server 'my-cluster-kafka-bootstrap.kafka.svc:9092' at topic 'test-topic' using the consumer group ID 'test-consumer-group' and sends the event messages to service 'event-display'
# Creates a new Kafka source named as 'mykafkasrc' which subscribes a Kafka server 'my-cluster-kafka-bootstrap.kafka.svc:9092' at topic 'test-topic' using the consumer group ID 'test-consumer-group' and sends the event messages to service 'event-display'
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# Creates a new Kafka source named as 'mykafkasrc' which subscribes a Kafka server 'my-cluster-kafka-bootstrap.kafka.svc:9092' at topic 'test-topic' using the consumer group ID 'test-consumer-group' and sends the event messages to service 'event-display'
# Create a new Kafka source 'mykafkasrc' which subscribes a Kafka server 'my-cluster-kafka-bootstrap.kafka.svc:9092' at topic 'test-topic' using the consumer group ID 'test-consumer-group' and sends the events to service 'event-display'

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed. Thank you.

describeCmd.Example = `#Describes a Kafka source with NAME
describeCmd.Use = "describe NAME"
describeCmd.Short = "Describe a Kafka source"
describeCmd.Example = `# Describes a Kafka source with NAME
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
describeCmd.Example = `# Describes a Kafka source with NAME
describeCmd.Example = `# Describe a Kafka source with NAME

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed.

Copy link
Contributor

@maximilien maximilien left a comment

Choose a reason for hiding this comment

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

I will fix the kn-source-pkg to match some of these Cobra.Long, Cobra.Short, Cobra.Use` usages

@knative-prow-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: daisy-ycguo

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 13, 2020
Copy link
Contributor

@maximilien maximilien left a comment

Choose a reason for hiding this comment

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

Some changes still needed.

* [kafka delete](#kafka-delete) - delete NAME
* [kafka describe](#kafka-describe) - describe NAME
* [kafka create](#kafka-create) - Create a kafka source
* [kafka delete](#kafka-delete) - Delete a Kafka source
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry but still seeing "Delete a Kafka source" which is not consistent with the "kafka" spelling. Am I missing something?

Copy link
Member Author

Choose a reason for hiding this comment

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

change all command output to lower case, except the first word of a sentence.

@@ -94,11 +94,11 @@ kn source kafka create mykafkasrc --servers my-cluster-kafka-bootstrap.kafka.svc

### kafka delete

delete NAME
Delete a Kafka source
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here...

Copy link
Member Author

Choose a reason for hiding this comment

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

change all command output to lower case, except the first word of a sentence.

@maximilien
Copy link
Contributor

/lgtm

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 22, 2020
@knative-prow-robot knative-prow-robot merged commit 58a2408 into knative:master Jul 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cla: yes Indicates the PR's author has signed the CLA. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[source-kafka] Fix subcommand's long, short, Use values and update docs
6 participants