Discourse: CLI cleanup (#1448)

- Remove username from help text.
- Simplify projectId generation.
This commit is contained in:
Robin van Boven 2019-11-15 14:19:08 +01:00 committed by GitHub
parent d6fb58bf2c
commit 8e693a942d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 8 deletions

View File

@ -78,15 +78,11 @@ const command: Command = async (args, std) => {
return die(std, "Expected one positional arguments (or --help).");
}
const [serverUrl] = positionalArgs;
let projectId = serverUrl;
if (projectId.startsWith("https://")) {
projectId = projectId.slice("https://".length);
} else if (projectId.startsWith("http://")) {
projectId = projectId.slice("http://".length);
} else {
const httpRE = new RegExp(/^https?:\/\//);
if (!httpRE.test(serverUrl)) {
die(std, "expected server url to start with 'https://' or 'http://'");
}
const projectId = serverUrl.trim().replace(httpRE, "");
const project: Project = {
id: projectId,
repoIds: [],

View File

@ -20,7 +20,6 @@ function usage(print: (string) => void): void {
usage: sourcecred gen-project PROJECT_ID
[--github GITHUB_SPEC [...]]
[--discourse-url DISCOURSE_URL]
[--discourse-username DISCOURSE_USERNAME]
sourcecred gen-project --help
Generates a SourceCred project configuration based on the provided specs.