Skip to content

differentiating required and optional arguments in the help text for … #175

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

Merged
merged 8 commits into from
Aug 20, 2019

Conversation

anusha94
Copy link
Contributor

By default, all the keyword arguments are listed under the optional arguments section. This will lead to confusion to the user as to which arguments are required and actually optional.

To solve this problem, I have created an argument group called required arguments and listed all the required args under this header.

This PR contains modifications to VMC samples only.

@vmwclabot
Copy link

@anusha94, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding Signed-off-by: John Doe <[email protected]> to the last line of each Git commit message. The e-mail address used to sign must match the e-mail address of the Git author. Click here to view the Developer Certificate of Origin agreement.

parser.add_argument('--refresh_token',
required_args = parser.add_argument_group('required arguments')

required_args.add_argument('--refresh_token',
required=True,
Copy link
Contributor

Choose a reason for hiding this comment

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

Try to maintain the vertical alignment..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Modified in the next commit

@vmwclabot
Copy link

@anusha94, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding Signed-off-by: John Doe <[email protected]> to the last line of each Git commit message. The e-mail address used to sign must match the e-mail address of the Git author. Click here to view the Developer Certificate of Origin agreement.

@@ -39,7 +39,8 @@ def __init__(self):
parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter)

required_args = parser.add_argument_group('required arguments')
required_args = parser.add_argument_group(
Copy link
Contributor

Choose a reason for hiding this comment

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

required_args is repeated in all the sample files. Can we declare it in library and use?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed in the next commit

  • new sample_cli.py file in the helpers directory
  • all other samples will import parser, required_args and optional_args as needed

@vmwclabot
Copy link

@anusha94, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding Signed-off-by: John Doe <[email protected]> to the last line of each Git commit message. The e-mail address used to sign must match the e-mail address of the Git author. Click here to view the Developer Certificate of Origin agreement.

Signed-off-by: Anusha Hegde <[email protected]>
@vmwclabot
Copy link

@anusha94, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding Signed-off-by: John Doe <[email protected]> to the last line of each Git commit message. The e-mail address used to sign must match the e-mail address of the Git author. Click here to view the Developer Certificate of Origin agreement.

required=True,
help='VMware Cloud API refresh token')
required_args.add_argument(
'--org-id', required=True, help='Organization identifier.')
Copy link
Contributor

Choose a reason for hiding this comment

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

Most of the samples require org_id and sddc_id. Please check if we can move both to sample_cli.py and build seperate arg parser where it is not required

@vmwclabot
Copy link

@anusha94, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding Signed-off-by: John Doe <[email protected]> to the last line of each Git commit message. The e-mail address used to sign must match the e-mail address of the Git author. Click here to view the Developer Certificate of Origin agreement.

import requests
from samples.vmc.helpers.sample_cli import parser, required_args
Copy link
Contributor

Choose a reason for hiding this comment

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

required_args is not required here?

@@ -34,51 +33,52 @@ class CreateDeleteSDDC(object):
"""

def __init__(self):
parser = argparse.ArgumentParser()
parser = argparse.ArgumentParser(
description='Standard Arguments for talking to vCenter')
Copy link
Contributor

Choose a reason for hiding this comment

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

Correct the description

help='Task status to filter. Possible values are: {} \
Show all tasks if no value is passed'.format(accepted))
parser = argparse.ArgumentParser(
description='Standard Arguments for talking to vCenter')
Copy link
Contributor

Choose a reason for hiding this comment

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

correct the description

Signed-off-by: Anusha Hegde <[email protected]>
@vmwclabot
Copy link

@anusha94, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding Signed-off-by: John Doe <[email protected]> to the last line of each Git commit message. The e-mail address used to sign must match the e-mail address of the Git author. Click here to view the Developer Certificate of Origin agreement.

@vmwclabot
Copy link

@anusha94, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding Signed-off-by: John Doe <[email protected]> to the last line of each Git commit message. The e-mail address used to sign must match the e-mail address of the Git author. Click here to view the Developer Certificate of Origin agreement.

@tianhao64 tianhao64 merged commit 2d2f32b into vmware:master Aug 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants