Skip to content

Commit ffdc1cc

Browse files
committed
refactor(cli): Review fixing
1 parent e5573b6 commit ffdc1cc

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

templates/cli/index.js.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ program
3535
.on("option:verbose", () => {
3636
cliConfig.verbose = true;
3737
})
38-
.on("option:report", () => {
38+
.on("option:report", function() {
3939
cliConfig.report = true;
4040
cliConfig.reportData = { data: this };
4141
})

templates/cli/lib/parser.js.twig

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -126,20 +126,25 @@ const parseError = (err) => {
126126
} catch {
127127
}
128128

129-
const version = '0.16.0';
130-
const stepsToReproduce = encodeURIComponent(`Running \`appwrite ${cliConfig.reportData.data.args}\``);
131-
const yourEnvironment = encodeURI(`CLI version: ${version}\nOperation System: ${os.type()}\nAppwrite version: ${appwriteVersion}\nIs Cloud: ${isCloud}`)
129+
const version = '{{ sdk.version }}';
130+
const stepsToReproduce = `Running \`appwrite ${cliConfig.reportData.data.args}\``;
131+
const yourEnvironment = `CLI version: ${version}\nOperation System: ${os.type()}\nAppwrite version: ${appwriteVersion}\nIs Cloud: ${isCloud}`;
132132

133-
const stack = encodeURIComponent('```\n' + err.stack + '\n```').replaceAll('(', '').replaceAll(')', '');
133+
const stack = '```\n' + err.stack + '\n```';
134134

135-
const githubIssueUrl = `https://github.com/appwrite/appwrite/issues/new?labels=bug&template=bug.yaml&title=%F0%9F%90%9B+Bug+Report%3A+CLI+error:+${encodeURI(err.message)}&actual-behavior=CLI%20Error:%0A${stack}&steps-to-reproduce=${stepsToReproduce}&environment=${yourEnvironment}`;
135+
const githubIssueUrl = new URL('https://github.com/appwrite/appwrite/issues/new');
136+
githubIssueUrl.searchParams.append('labels', 'bug');
137+
githubIssueUrl.searchParams.append('template', 'bug.yaml');
138+
githubIssueUrl.searchParams.append('title', `🐛 Bug Report: ${err.message}`);
139+
githubIssueUrl.searchParams.append('actual-behavior', `CLI Error:\n${stack}`);
140+
githubIssueUrl.searchParams.append('steps-to-reproduce', stepsToReproduce);
141+
githubIssueUrl.searchParams.append('environment', yourEnvironment);
136142

137-
log(`To report this error you can:\n - Create a support ticket in our Discord server https://appwrite.io/discord \n - Create an issue in our Github\n ${githubIssueUrl}\n`);
143+
log(`To report this error you can:\n - Create a support ticket in our Discord server https://appwrite.io/discord \n - Create an issue in our Github\n ${githubIssueUrl.href}\n`);
138144

139145
process.exit(1);
140146
})()
141-
}
142-
else {
147+
} else {
143148
if (cliConfig.verbose) {
144149
console.error(err);
145150
} else {

0 commit comments

Comments
 (0)