Skip to content
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

Update the CLI docs #39

Merged
merged 3 commits into from
Mar 16, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 14 additions & 39 deletions Documentation/cli.md
Original file line number Diff line number Diff line change
@@ -1,66 +1,41 @@
#AutoRest Command Line Interface Documentation

##Contents

* [Name](#name)
* [Synopsis](#synopsis)
* [Description](#description)
* [Parameters](#parameters)
* [Examples](#examples)


##Name
`AutoRest.exe` The **AutoRest** tool generates client libraries for accessing RESTful web services.

##Synopsis
##Syntax
```bash
'AutoRest.exe' -CodeGenerator <value> -Modeler <value> -Input <value> -BaseNamespace <value> [-OutputFolder <value>] [-OutputAsSingleFile <value>] [-Header <value>] [-AddCredentials <value>]
AutoRest.exe -CodeGenerator <value> -Modeler <value> -Input <value> -BaseNamespace <value> [-OutputFolder <value>] [-OutputAsSingleFile <value>] [-Header <value>] [-AddCredentials <value>]
```
##Description
AutoRest is an extensible client library generator and can support multiple types of input and output. AutoRest.exe comes with the `AutoRest.json` configuration file that defines the available inputs (Modelers) and outputs (CodeGenerators). When invoking AutoRest.exe, you must specify the `-Modeler` and `-CodeGenerator` to use.

##Parameters
**-OutputFolder**
Output folder for generated files. Defaults to `Generated` directory.
**-OutputFolder** Output folder for generated files. Defaults to Generated directory.

**-OutputAsSingleFile**
Output file name. If specified, all the code will be written into this single file. Otherwise, AutoRest will split code by operations and write individual files into OutputFolder.
**-OutputAsSingleFile** Output file name. If specified, all the code will be written into this single file. Otherwise, AutoRest will split code by operations and write individual files into OutputFolder.

**-CodeGenerator**
Code generation language. So far we have the following languages supported (the list is growing):
**-CodeGenerator** Code generation language.

- C#
**-Modeler** Modeler for the input specification.

**-Modeler**
The input specification type. So far we only support [Swagger 2.0](https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md).
**-Input** Path to the input specification file. URLs are not supported at this moment.

**-Input**
Path to the input specification file. URLs are not supported at this moment.
**-BaseNamespace** Base namespace for generated code

**-BaseNamespace**
Base namespace for generated code. This is a required parameter but not used for all languages.
**-Header** Default file header contents. Use NONE if no header is required.

**-Header**
Default file header contents. Use `NONE` if no header is required.
**-AddCredentials** If set to true the generated client will have ServiceClientCredentials property. A set of corresponding constructors will be generated and its ProcessHtppRequestAsync method will be called on the http requests. Users can derive from this class to add their customized authentication behaviors.

**-AddCredentials**
If set to true the generated client will have [ServiceClientCredentials](https://github.com/Azure/AutoRest/blob/master/Microsoft.Rest/ClientRuntime/ServiceClientCredentials.cs) property. A set of corresponding constructors will be generated and its `ProcessHtppRequestAsync` method will be called on the http requests. Users can derive from this class to add their customized authentication behaviors.


##Examples
- Generate C# client library from a Swagger formatted input specification `swagger.json` with namespace `MyNamespace`:
- Generate C# client library from a Swagger formatted input specification swagger.json with namespace MyNamespace:
```bash
AutoRest.exe -CodeGenerator CSharp -Modeler Swagger -Input swagger.json -BaseNamespace MyNamespace
```
This will generate all the C# files for corresponding operations in the `Generated` directory.

- Generate C# client library from a Swagger formatted input specification `swagger.json` with namespace `MyNamespace` into one single file `client.cs` with a customized header:
- Generate C# client library from a Swagger formatted input specification swagger.json with namespace MyNamespace into one single file client.cs with a customized header:
```bash
AutoRest.exe -CodeGenerator CSharp -OutputAsSingleFile client.cs -Modeler Swagger -Input swagger.json -BaseNamespace MyNamespace -Header "Copyright Contoso Ltd"
```
This will generate one single file `client.cs` in the `Generated` directory.

- Generate C# client library from a Swagger formatted input specification `swagger.json` with namespace `MyNamespace` with credential property added:
- Generate C# client library from a Swagger formatted input specification swagger.json with namespace MyNamespace with credential property added:
```bash
AutoRest.exe -CodeGenerator CSharp -Modeler Swagger -Input swagger.json -BaseNamespace MyNamespace -AddCredentials true
```
```