-
Notifications
You must be signed in to change notification settings - Fork 867
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add --serve to default command (#8684)
- Loading branch information
Showing
10 changed files
with
48 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,32 @@ | ||
// Copyright (c) Microsoft. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
using System.ComponentModel; | ||
using System.Diagnostics.CodeAnalysis; | ||
using Spectre.Console.Cli; | ||
|
||
namespace Microsoft.DocAsCode; | ||
|
||
internal class ServeCommand : Command<ServeCommandOptions> | ||
internal class ServeCommand : Command<ServeCommand.Settings> | ||
{ | ||
public override int Execute([NotNull] CommandContext context, [NotNull] ServeCommandOptions options) | ||
[Description("Host a local static website")] | ||
internal class Settings : CommandSettings | ||
{ | ||
return CommandHelper.Run(() => | ||
{ | ||
RunServe.Exec( | ||
options.Folder, | ||
options.Host, | ||
options.Port.HasValue ? options.Port.Value.ToString() : null); | ||
}); | ||
[Description("Path to the directory to serve")] | ||
[CommandArgument(0, "[directory]")] | ||
public string Folder { get; set; } | ||
|
||
[Description("Specify the hostname of the hosted website [localhost]")] | ||
[CommandOption("-n|--hostname")] | ||
public string Host { get; set; } | ||
|
||
[Description("Specify the port of the hosted website [8080]")] | ||
[CommandOption("-p|--port")] | ||
public int? Port { get; set; } | ||
} | ||
|
||
public override int Execute([NotNull] CommandContext context, [NotNull] Settings options) | ||
{ | ||
return CommandHelper.Run(() => RunServe.Exec(options.Folder, options.Host, options.Port)); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters