From 5c12fb07680660d3a9e90634f9fff85091e22660 Mon Sep 17 00:00:00 2001 From: Halil ibrahim Kalkan Date: Thu, 30 May 2019 22:56:59 +0300 Subject: [PATCH] Created CLI documentation. --- docs/en/CLI.md | 114 ++++++++++++++++++ docs/en/Startup-Templates/Index.md | 6 + docs/en/Startup-Templates/Mvc-Module.md | 6 + docs/en/Startup-Templates/Mvc.md | 6 + .../Volo/Abp/Cli/Commands/AddModuleCommand.cs | 2 +- .../Volo/Abp/Cli/Commands/HelpCommand.cs | 2 + .../Volo/Abp/Cli/Commands/NewCommand.cs | 11 +- 7 files changed, 144 insertions(+), 3 deletions(-) create mode 100644 docs/en/CLI.md create mode 100644 docs/en/Startup-Templates/Index.md create mode 100644 docs/en/Startup-Templates/Mvc-Module.md create mode 100644 docs/en/Startup-Templates/Mvc.md diff --git a/docs/en/CLI.md b/docs/en/CLI.md new file mode 100644 index 0000000000..19b532796e --- /dev/null +++ b/docs/en/CLI.md @@ -0,0 +1,114 @@ +# ABP CLI + +ABP CLI (Command Line Interface) is a command line tool to perform some common operations for ABP based solutions. + +## new + +Generates a new solution based on the ABP [startup templates](Startup-Templates/Index.md). + +Basic usage: + +````bash +abp new +```` + +Example: + +````bash +abp new Acme.BookStore +```` + +* Acme.BookStore is the solution name here. +* Common convention is to name a solution is like *YourCompany.YourProject*. However, you can use different naming like *YourProject* (single level namespacing) or *YourCompany.YourProduct.YourModule* (three levels namespacing). + +### Options + +* `--template` or `-t`: Specifies the template name. Default template name is `mvc`. Available templates: + * `mvc` (default): ASP.NET Core [MVC application template](Startup-Templates/Mvc.md). Additional options: + * `--database-provider` or `-d`: Specifies the database provider. Default provider is `ef`. Available providers: + * `ef`: Entity Framework Core. + * `mongodb`: MongoDB. + * `--tiered`: Creates a tiered options where Web and Http API layers can be physically separated. + * `mvc-module`: ASP.NET Core [MVC module template](Startup-Templates/Mvc-Module.md). Additional options: + * `--no-ui`: Specifies to not include the UI. This makes possible to create service-only modules (a.k.a. microservices - without UI). +* `--output-folder` or `-o`: Specifies the output folder. Default value is the current directory. + +## add-package + +Adds a new ABP package to a project by, + +* Adding related nuget package as a dependency to the project. +* Adding `[DependsOn(...)]` attribute to the module class in the project (see the [module development document](Module-Development-Basics.md)). + +> Notice that the added module may require additional configuration which is generally indicated in the documentation of the related package. + +Basic usage: + +````bash +abp add-package +```` + +Example: + +```` +abp add-package Volo.Abp.MongoDB +```` + +* This example adds the Volo.Abp.MongoDB package to the project. + +### Options + +* `--project` or `-p`: Specifies the project (.csproj) file path. If not specified, CLI tries to find a .csproj file in the current directory. + +## add-module + +Adds a multi-package module to a solution by finding all packages of the module, finding related projects in the solution and adding each package to the corresponding project in the solution. + +> A business module generally consists of several packages (because of layering, different database providr options or other reasons). Using `add-module` command dramatically simplifies adding a module to a solution. However, each module may require some additional configurations which is generally indicated in the documentation of the related module. + +Basic usage: + +````bash +abp add-module +```` + +Example: + +```bash +abp add-module Volo.Blogging +``` + +* This example add the Volo.Blogging module to the solution. + +### Options + +* `--solution` or `-s`: Specifies the solution (.sln) file path. If not specified, CLI tries to find a .sln file in the current directory. +* `--skip-db-migrations`: For EF Core database provider, it automatically adds a new code first migration (`Add-Migration`) and updates the database (`Update-Database`) if necessary. Specify this option to skip this operation. + +## update + +Updating all ABP related packages can be tedious since there are many packages of the framework and modules. This command automatically updates all ABP related packages in a solution or project to the latest versions. + +Usage: + +````bash +abp update +```` + +* If you run in a directory with a .sln file, it updates all ABP related packages of the all projects of the solution to the latest versions. +* If you run in a directory with a .csproj file, it updates all ABP related packages of the project to the latest versions. + +### Options + +* `--include-previews` or `-p`: Includes preview, beta and rc packages while checking the latest versions. + +## help + +Writes basic usage information of the CLI. + +Usage: + +````bash +abp help +```` + diff --git a/docs/en/Startup-Templates/Index.md b/docs/en/Startup-Templates/Index.md new file mode 100644 index 0000000000..9eb280d205 --- /dev/null +++ b/docs/en/Startup-Templates/Index.md @@ -0,0 +1,6 @@ +# Startup Templates + +TODO + + + diff --git a/docs/en/Startup-Templates/Mvc-Module.md b/docs/en/Startup-Templates/Mvc-Module.md new file mode 100644 index 0000000000..b641d78bac --- /dev/null +++ b/docs/en/Startup-Templates/Mvc-Module.md @@ -0,0 +1,6 @@ +# MVC Module Startup Template + +TODO + + + diff --git a/docs/en/Startup-Templates/Mvc.md b/docs/en/Startup-Templates/Mvc.md new file mode 100644 index 0000000000..0deba09da4 --- /dev/null +++ b/docs/en/Startup-Templates/Mvc.md @@ -0,0 +1,6 @@ +# MVC Application Startup Template + +TODO + + + diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddModuleCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddModuleCommand.cs index 7925b82aa6..985ca49f17 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddModuleCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddModuleCommand.cs @@ -98,7 +98,7 @@ namespace Volo.Abp.Cli.Commands sb.AppendLine("Examples:"); sb.AppendLine(" abp add-module Volo.Blogging Adds the module to the current soluton."); sb.AppendLine(" abp add-module Volo.Blogging -s Acme.BookStore Adds the module to the given soluton."); - sb.AppendLine(" abp add-module Volo.Blogging -s Acme.BookStore --skip-db-migrations false Adds the module to the given soluton but doesn't add-migration."); + sb.AppendLine(" abp add-module Volo.Blogging -s Acme.BookStore --skip-db-migrations false Adds the module to the given soluton but doesn't create a database migration."); sb.AppendLine(""); return sb.ToString(); diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/HelpCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/HelpCommand.cs index 671bf3cbab..85e421588f 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/HelpCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/HelpCommand.cs @@ -23,6 +23,8 @@ namespace Volo.Abp.Cli.Commands Logger.LogInformation(" abp [options]"); Logger.LogInformation(""); + //TODO: Write available commands (not hard-coded, but from the CliOptions.Commands) + return Task.CompletedTask; } } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs index 19865bdacf..5979348004 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs @@ -35,14 +35,21 @@ namespace Volo.Abp.Cli.Commands Logger.LogWarning(""); Logger.LogWarning("Options:"); Logger.LogWarning("-t|--template "); - Logger.LogWarning("-d|--database-provider "); Logger.LogWarning("-o|--output-folder "); + Logger.LogWarning("-d|--database-provider (if supported by the template)"); + Logger.LogWarning("--tiered (if supported by the template)"); + Logger.LogWarning("--no-ui (if supported by the template)"); Logger.LogWarning(""); - Logger.LogWarning("Examples:"); + Logger.LogWarning("Some examples:"); Logger.LogWarning(" abp new Acme.BookStore"); + Logger.LogWarning(" abp new Acme.BookStore --tiered"); Logger.LogWarning(" abp new Acme.BookStore -t mvc-module"); + Logger.LogWarning(" abp new Acme.BookStore -t mvc-module no-ui"); + Logger.LogWarning(" abp new Acme.BookStore -d mongodb"); Logger.LogWarning(" abp new Acme.BookStore -t mvc -d mongodb"); Logger.LogWarning(" abp new Acme.BookStore -t mvc -d mongodb -o d:\\project"); + Logger.LogWarning(""); + Logger.LogWarning("See the documentation for more info."); return; }