Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-helmich committed Jan 25, 2024
1 parent 1362242 commit 300562a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 10 deletions.
22 changes: 15 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1784,12 +1784,13 @@ Set context values for the current project, org or server

```
USAGE
$ mw context set [--project-id <value>] [--server-id <value>] [--org-id <value>]
$ mw context set [--project-id <value>] [--server-id <value>] [--org-id <value>] [--installation-id <value>]
FLAGS
--org-id=<value> ID or short ID of an organization
--project-id=<value> ID or short ID of a project
--server-id=<value> ID or short ID of a server
--installation-id=<value> ID or short ID of an app installation
--org-id=<value> ID or short ID of an organization
--project-id=<value> ID or short ID of a project
--server-id=<value> ID or short ID of a server
DESCRIPTION
Set context values for the current project, org or server
Expand Down Expand Up @@ -1936,12 +1937,14 @@ Create a new cron job

```
USAGE
$ mw cronjob create --description <value> --interval <value> [-i <value>] [-q] [--disable] [--email <value>]
[--url <value> | --command <value>] [--interpreter <value>]
$ mw cronjob create --description <value> --interval <value> [-p <value>] [-i <value>] [-q] [--disable] [--email
<value>] [--url <value> | --command <value>] [--interpreter <value>]
FLAGS
-i, --installation-id=<value> ID or short ID of an app installation; this flag is optional if a default app
installation is set in the context
-p, --project-id=<value> ID or short ID of a project; this flag is optional if a default project is set in the
context
-q, --quiet suppress process output and only display a machine-readable summary.
--command=<value> Command to execute for the cron job; either this or `--url` is required.
--description=<value> (required) Description of the cron job
Expand All @@ -1956,10 +1959,15 @@ FLAG DESCRIPTIONS
ID or short ID of an app installation; this flag is optional if a default app installation is set in the context
May contain a short ID or a full ID of an app installation; you can also use the "mw context set
May contain a short ID or a full ID of an app installation.; you can also use the "mw context set
--installation-id=<VALUE>" command to persistently set a default app installation for all commands that accept this
flag.
-p, --project-id=<value> ID or short ID of a project; this flag is optional if a default project is set in the context
May contain a short ID or a full ID of a project; you can also use the "mw context set --project-id=<VALUE>" command
to persistently set a default project for all commands that accept this flag.
-q, --quiet suppress process output and only display a machine-readable summary.
This flag controls if you want to see the process output or only a summary. When using mw non-interactively (e.g. in
Expand Down
19 changes: 16 additions & 3 deletions src/lib/project/flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,26 +43,39 @@ export function makeProjectFlagSet<TName extends ContextNames>(
displayName = name,
supportsContext = false,
} = opts;
const article = displayName.match(/^[aeiou]/i) ? "an" : "a";

const flagName: ContextKey<TName> = `${name}-id`;
const flags = {
...projectFlags,
[flagName]: Flags.string({
char,
required: !supportsContext,
summary: `ID or ${shortIDName} of a ${displayName}`,
description: `May contain a ${shortIDName} or a full ID of a ${displayName}.`,
summary: `ID or ${shortIDName} of ${article} ${displayName}`,
description: `May contain a ${shortIDName} or a full ID of ${article} ${displayName}.`,
default: undefined,
}),
} as ContextFlags<TName | "project">;

const args = {
[flagName]: Args.string({
description: `ID or ${shortIDName} of a ${displayName}`,
description: `ID or ${shortIDName} of ${article} ${displayName}`,
required: !supportsContext,
}),
} as ContextArgs<TName | "project">;

if (supportsContext) {
flags[
flagName
].summary += `; this flag is optional if a default ${displayName} is set in the context`;
flags[
flagName
].description += `; you can also use the "<%= config.bin %> context set --${flagName}=<VALUE>" command to persistently set a default ${displayName} for all commands that accept this flag.`;
args[
flagName
].description += `; this argument is optional if a default ${displayName} is set in the context`;
}

const idFromArgsOrFlag = (
flags: FlagOutput,
args: ArgOutput,
Expand Down

0 comments on commit 300562a

Please sign in to comment.