Skip to content
This repository has been archived by the owner on Jul 14, 2023. It is now read-only.

Commit

Permalink
Fix string bug in windows (#480)
Browse files Browse the repository at this point in the history
  • Loading branch information
qiaozha authored Jul 23, 2020
1 parent 5b3fa18 commit a7fd9bb
Show file tree
Hide file tree
Showing 6 changed files with 230 additions and 211 deletions.
16 changes: 2 additions & 14 deletions src/plugins/azgenerator/TemplateAzureCliCustom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -484,13 +484,7 @@ function GetPolyMethodCall(model: CodeModelAz, prefix: any, originalOperation: O
parameterPair = model.Parameter_NamePython(param) + "=None";
}
} else {
if(model.Parameter_Type(param) == SchemaType.Integer) {
parameterPair = parameterName + "=int(" + optionName + ")";
} else if(model.Parameter_Type(param) == SchemaType.Number) {
parameterPair = parameterName + "=float(" + optionName + ")";
} else {
parameterPair = parameterName + "=" + optionName;
}
parameterPair = parameterName + "=" + optionName;
}


Expand Down Expand Up @@ -567,13 +561,7 @@ function GetMethodCall(model: CodeModelAz, required: any, prefix: any): string[]
}
}
else {
if(model.MethodParameter_Type == SchemaType.Integer) {
parameterPair = model.MethodParameter_NamePython + "=int(" + model.MethodParameter_MapsTo + ")";
} else if(model.MethodParameter_Type == SchemaType.Number) {
parameterPair = model.MethodParameter_NamePython + "=float(" + model.MethodParameter_MapsTo + ")";
} else {
parameterPair = model.MethodParameter_NamePython + "=" + model.MethodParameter_MapsTo;
}
parameterPair = model.MethodParameter_NamePython + "=" + model.MethodParameter_MapsTo;
}

if (methodCall.endsWith("(")) {
Expand Down
8 changes: 8 additions & 0 deletions src/plugins/azgenerator/TemplateAzureCliParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,14 @@ function getCommandBody(model: CodeModelAz, needGeneric: boolean = false, debug:
}

if (!needSkip) {
if (model.MethodParameter_Type == SchemaType.Integer) {
argument += ", type=int"
} else if(model.MethodParameter_Type == SchemaType.Number) {
argument += ", type=float"
} else if(model.MethodParameter_Type == SchemaType.String) {
argument += ", type=str"
}

argument += ", help='" + EscapeString(model.MethodParameter_Description).trimRight();
if (model.MethodParameter_IsList && !model.MethodParameter_IsSimpleArray) {
let netDescription = model.MethodParameter_Description.trim();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ def load_arguments(self, _):

with self.argument_context('attestation create-provider') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('provider_name', help='Name of the attestation service')
c.argument('provider_name', type=str, help='Name of the attestation service')
c.argument('location', arg_type=get_location_type(self.cli_ctx),
validator=get_default_location_from_resource_group)
c.argument('tags', tags_type)
c.argument('attestation_policy', help='Name of attestation policy.')
c.argument('attestation_policy', type=str, help='Name of attestation policy.')
c.argument('policy_signing_certificates_keys', action=AddPolicySigningCertificatesKeys, nargs='*', help='The '
'value of the "keys" parameter is an array of JWK values. By default, the order of the JWK values '
'within the array does not imply an order of preference among them, although applications of JWK '
Expand All @@ -38,13 +38,13 @@ def load_arguments(self, _):

with self.argument_context('attestation attestation-provider show') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('provider_name', help='Name of the attestation service instance', id_part='name')
c.argument('provider_name', type=str, help='Name of the attestation service instance', id_part='name')

with self.argument_context('attestation attestation-provider update') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('provider_name', help='Name of the attestation service', id_part='name')
c.argument('provider_name', type=str, help='Name of the attestation service', id_part='name')
c.argument('tags', tags_type)

with self.argument_context('attestation attestation-provider delete') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('provider_name', help='Name of the attestation service', id_part='name')
c.argument('provider_name', type=str, help='Name of the attestation service', id_part='name')
Loading

0 comments on commit a7fd9bb

Please sign in to comment.