Skip to content

Commit d1efdc0

Browse files
committed
add new animations for how-tos
1 parent 6cff5f5 commit d1efdc0

65 files changed

Lines changed: 391 additions & 84 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Spectre.Docs.Cli.Examples/DemoApps/FlagArguments/Main.cs

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,15 @@ internal class ServerCommand : Command<ServerCommand.Settings>
2525
/// </summary>
2626
public class Settings : CommandSettings
2727
{
28-
// FlagValue<int> - can be used as --port (uses default) or --port 8080 (uses specified)
2928
[CommandOption("--port [PORT]")]
3029
[Description("The port to listen on (default: 3000 if flag present)")]
30+
[DefaultValue(3000)]
3131
public required FlagValue<int> Port { get; init; }
3232

33-
// FlagValue<int?> - nullable inner type for truly optional values
3433
[CommandOption("--timeout [SECONDS]")]
3534
[Description("Connection timeout in seconds")]
3635
public required FlagValue<int?> Timeout { get; init; }
3736

38-
// Regular option for comparison
3937
[CommandOption("-h|--host")]
4038
[Description("The host to bind to")]
4139
[DefaultValue("localhost")]
@@ -47,32 +45,27 @@ protected override int Execute(CommandContext context, Settings settings, Cancel
4745
System.Console.WriteLine($"Host: {settings.Host}");
4846

4947
// Check if --port flag was provided
50-
if (settings.Port?.IsSet == true)
48+
if (settings.Port.IsSet)
5149
{
52-
// Value is the parsed port number (or default if none specified)
53-
var port = settings.Port.Value;
54-
System.Console.WriteLine($"Port: {port}");
50+
System.Console.WriteLine($"Port: {settings.Port.Value}");
5551
}
5652
else
5753
{
5854
System.Console.WriteLine("Port: not specified (will use system default)");
5955
}
6056

6157
// Check if --timeout flag was provided
62-
if (settings.Timeout?.IsSet == true)
58+
if (settings.Timeout is { IsSet: true, Value: not null })
6359
{
64-
if (settings.Timeout.Value.HasValue)
65-
{
66-
System.Console.WriteLine($"Timeout: {settings.Timeout.Value} seconds");
67-
}
68-
else
69-
{
70-
System.Console.WriteLine("Timeout: enabled (no specific value)");
71-
}
60+
System.Console.WriteLine($"Timeout: {settings.Timeout.Value} seconds");
61+
}
62+
else if (settings.Timeout.IsSet)
63+
{
64+
System.Console.WriteLine($"Timeout: system default seconds");
7265
}
7366
else
7467
{
75-
System.Console.WriteLine("Timeout: not specified");
68+
System.Console.WriteLine("Timeout: disabled");
7669
}
7770

7871
return 0;
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
Output "Spectre.Docs/Content/assets/cli-command-hierarchies.svg"
2+
3+
Set Shell "pwsh"
4+
Set FontSize 22
5+
Set Theme "one dark"
6+
Set TransparentBackground "true"
7+
Set Cols 80
8+
Set Rows 20
9+
Set EndBuffer 5s
10+
Set WorkingDirectory "Spectre.Docs.Cli.Examples/bin/Debug/net10.0"
11+
Env SPECTRE_APP "M:Spectre.Docs.Cli.Examples.DemoApps.CommandHierarchies.Demo.RunAsync(System.String[])"
12+
13+
Type "./example remote add origin https://github.com/user/repo.git"
14+
Sleep 400ms
15+
Enter
16+
Sleep 2s
17+
18+
Type "./example remote ls --verbose"
19+
Sleep 400ms
20+
Enter
21+
Sleep 2s
22+
23+
Type "./example remote rm origin"
24+
Sleep 400ms
25+
Enter
26+
Sleep 3s
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
Output "Spectre.Docs/Content/assets/cli-configuring-app.svg"
2+
3+
Set Shell "pwsh"
4+
Set FontSize 22
5+
Set Theme "one dark"
6+
Set TransparentBackground "true"
7+
Set Cols 80
8+
Set Rows 22
9+
Set EndBuffer 5s
10+
Set WorkingDirectory "Spectre.Docs.Cli.Examples/bin/Debug/net10.0"
11+
Env SPECTRE_APP "M:Spectre.Docs.Cli.Examples.DemoApps.ConfiguringCommandApp.Demo.RunAsync(System.String[])"
12+
13+
Type "./example --help"
14+
Sleep 400ms
15+
Enter
16+
Sleep 2500ms
17+
18+
Type "./example add todo.txt"
19+
Sleep 400ms
20+
Enter
21+
Sleep 2s
22+
23+
Type "./example a notes.md --force"
24+
Sleep 400ms
25+
Enter
26+
Sleep 2s
27+
28+
Type "./example ls --all"
29+
Sleep 400ms
30+
Enter
31+
Sleep 3s
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Output "Spectre.Docs/Content/assets/cli-custom-type-converters.svg"
2+
3+
Set Shell "pwsh"
4+
Set FontSize 22
5+
Set Theme "one dark"
6+
Set TransparentBackground "true"
7+
Set Cols 80
8+
Set Rows 18
9+
Set EndBuffer 5s
10+
Set WorkingDirectory "Spectre.Docs.Cli.Examples/bin/Debug/net10.0"
11+
Env SPECTRE_APP "M:Spectre.Docs.Cli.Examples.DemoApps.CustomTypeConverters.Demo.RunAsync(System.String[])"
12+
13+
Type "./example --point 10,20"
14+
Sleep 400ms
15+
Enter
16+
Sleep 2s
17+
18+
Type "./example --point 100,200 --offset 5,5 -c red"
19+
Sleep 400ms
20+
Enter
21+
Sleep 3s
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Output "Spectre.Docs/Content/assets/cli-customizing-help.svg"
2+
3+
Set Shell "pwsh"
4+
Set FontSize 22
5+
Set Theme "one dark"
6+
Set TransparentBackground "true"
7+
Set Cols 80
8+
Set Rows 24
9+
Set EndBuffer 5s
10+
Set WorkingDirectory "Spectre.Docs.Cli.Examples/bin/Debug/net10.0"
11+
Env SPECTRE_APP "M:Spectre.Docs.Cli.Examples.DemoApps.CustomizingHelpText.Demo.RunAsync(System.String[])"
12+
13+
Type "./example --help"
14+
Sleep 400ms
15+
Enter
16+
Sleep 4s
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
Output "Spectre.Docs/Content/assets/cli-defining-arguments.svg"
2+
3+
Set Shell "pwsh"
4+
Set FontSize 22
5+
Set Theme "one dark"
6+
Set TransparentBackground "true"
7+
Set Cols 80
8+
Set Rows 20
9+
Set EndBuffer 5s
10+
Set WorkingDirectory "Spectre.Docs.Cli.Examples/bin/Debug/net10.0"
11+
Env SPECTRE_APP "M:Spectre.Docs.Cli.Examples.DemoApps.DefiningCommandsAndArguments.Demo.RunAsync(System.String[])"
12+
13+
Type "./example myfile.txt"
14+
Sleep 400ms
15+
Enter
16+
Sleep 2s
17+
18+
Type "./example myfile.txt /backup --force -b 128"
19+
Sleep 400ms
20+
Enter
21+
Sleep 2s
22+
23+
Type "./example input.txt output.txt -v --preserve-timestamps"
24+
Sleep 400ms
25+
Enter
26+
Sleep 3s
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Output "Spectre.Docs/Content/assets/cli-dictionary-options.svg"
2+
3+
Set Shell "pwsh"
4+
Set FontSize 22
5+
Set Theme "one dark"
6+
Set TransparentBackground "true"
7+
Set Cols 90
8+
Set Rows 20
9+
Set EndBuffer 5s
10+
Set WorkingDirectory "Spectre.Docs.Cli.Examples/bin/Debug/net10.0"
11+
Env SPECTRE_APP "M:Spectre.Docs.Cli.Examples.DemoApps.DictionaryOptions.Demo.RunAsync(System.String[])"
12+
13+
Type "./example --value port=8080 --value timeout=30 --value retries=3"
14+
Sleep 400ms
15+
Enter
16+
Sleep 2500ms
17+
18+
Type "./example --lookup env=dev --lookup env=staging --lookup region=us"
19+
Sleep 400ms
20+
Enter
21+
Sleep 3s
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Output "Spectre.Docs/Content/assets/cli-error-handling.svg"
2+
3+
Set Shell "pwsh"
4+
Set FontSize 22
5+
Set Theme "one dark"
6+
Set TransparentBackground "true"
7+
Set Cols 90
8+
Set Rows 24
9+
Set EndBuffer 5s
10+
Set WorkingDirectory "Spectre.Docs.Cli.Examples/bin/Debug/net10.0"
11+
Env SPECTRE_APP "M:Spectre.Docs.Cli.Examples.DemoApps.HandlingErrorsAndExitCodes.Demo.RunAsync(System.String[])"
12+
13+
Type "./example nonexistent-file.txt"
14+
Sleep 400ms
15+
Enter
16+
Sleep 3s
17+
18+
Type "echo Exit code: $LASTEXITCODE"
19+
Sleep 400ms
20+
Enter
21+
Sleep 3s
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
Output "Spectre.Docs/Content/assets/cli-flag-arguments.svg"
2+
3+
Set Shell "pwsh"
4+
Set FontSize 22
5+
Set Theme "one dark"
6+
Set TransparentBackground "true"
7+
Set Cols 80
8+
Set Rows 20
9+
Set EndBuffer 5s
10+
Set WorkingDirectory "Spectre.Docs.Cli.Examples/bin/Debug/net10.0"
11+
Env SPECTRE_APP "M:Spectre.Docs.Cli.Examples.DemoApps.FlagArguments.Demo.RunAsync(System.String[])"
12+
13+
Type "./example"
14+
Sleep 400ms
15+
Enter
16+
Sleep 2s
17+
18+
Type "./example --port"
19+
Sleep 400ms
20+
Enter
21+
Sleep 2s
22+
23+
Type "./example --port 8080"
24+
Sleep 400ms
25+
Enter
26+
Sleep 2s
27+
28+
Type "./example --port 8080 --timeout 30 --host 0.0.0.0"
29+
Sleep 400ms
30+
Enter
31+
Sleep 3s
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
Output "Spectre.Docs/Content/assets/cli-hiding-commands.svg"
2+
3+
Set Shell "pwsh"
4+
Set FontSize 22
5+
Set Theme "one dark"
6+
Set TransparentBackground "true"
7+
Set Cols 80
8+
Set Rows 20
9+
Set EndBuffer 5s
10+
Set WorkingDirectory "Spectre.Docs.Cli.Examples/bin/Debug/net10.0"
11+
Env SPECTRE_APP "M:Spectre.Docs.Cli.Examples.DemoApps.HidingCommandsAndOptions.Demo.RunAsync(System.String[])"
12+
13+
Type "./example --help"
14+
Sleep 400ms
15+
Enter
16+
Sleep 2500ms
17+
18+
Type "./example diagnostics"
19+
Sleep 400ms
20+
Enter
21+
Sleep 2s
22+
23+
Type "./example deploy production --skip-hooks"
24+
Sleep 400ms
25+
Enter
26+
Sleep 3s

0 commit comments

Comments
 (0)