This repository has been archived by the owner on Jun 7, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Types.fs
69 lines (57 loc) · 2.11 KB
/
Types.fs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
namespace Clam.Types
open System
open Argu
open LiteDB
[<CLIMutable>]
type ClamRepo =
{ _id: ObjectId
name: string
fullName: string
branch: string
path: string
createdAt: DateTime
updatedAt: Nullable<DateTime> }
type NameParsingErrors =
| MissingRepoName
| WrongGithubFormat
type TemplateNameKind =
| SimpleName = 1
| FullName = 2
type RepositoryOptions =
{ repositoryName: string
branch: string }
type ProjectOptions =
{ projectName: string
templateName: string }
type RepositoryArgs =
| [<AltCommandLine("-n")>] RepositoryName of string
| [<AltCommandLine("-b")>] Branch of string option
interface IArgParserTemplate with
member s.Usage =
match s with
| RepositoryName _ -> "Name of the repository where the template lives"
| Branch _ -> "Branch to pick the repository from, defaults to \"main\""
type NewProjectArgs =
| [<AltCommandLine("-t")>] Template of string
| [<AltCommandLine("-n")>] ProjectName of string
interface IArgParserTemplate with
member s.Usage =
match s with
| ProjectName _ -> "Name of the project to create."
| Template _ -> "Template to use for this project."
type CliArguments =
| [<CliPrefix(CliPrefix.None)>] List
| [<CliPrefix(CliPrefix.None)>] Add of ParseResults<RepositoryArgs>
| [<CliPrefix(CliPrefix.None)>] Update of ParseResults<RepositoryArgs>
| [<CliPrefix(CliPrefix.None)>] Remove of name: string
| [<CliPrefix(CliPrefix.None)>] New of ParseResults<NewProjectArgs>
| [<CliPrefix(CliPrefix.DoubleDash); AltCommandLine("-v")>] Version
interface IArgParserTemplate with
member s.Usage =
match s with
| List -> "Shows the existing template repositories."
| Add _ -> "Adds a new template repository."
| Update _ -> "Updates a specific template repository."
| Remove _ -> "Deletes a template repository."
| New _ -> "Scaffolds a new project from the existing repositories."
| Version -> "Shows the CLI version."