Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Improve command line to use rawArgs #870

Merged
merged 3 commits into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions templates/cli/index.js.twig
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const chalk = require("chalk");
const { version } = require("./package.json");
const { commandDescriptions, cliConfig } = require("./lib/parser");
const { client } = require("./lib/commands/generic");
const inquirer = require("inquirer");
{% if sdk.test != "true" %}
const { login, logout, whoami, migrate } = require("./lib/commands/generic");
const { init } = require("./lib/commands/init");
Expand All @@ -22,6 +23,8 @@ const { migrate } = require("./lib/commands/generic");
const { {{ service.name | caseLower }} } = require("./lib/commands/{{ service.name | caseLower }}");
{% endfor %}

inquirer.registerPrompt('search-list', require('inquirer-search-list'));

program
.description(commandDescriptions['main'])
.configureHelp({
Expand Down
2 changes: 1 addition & 1 deletion templates/cli/lib/parser.js.twig
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ const parseError = (err) => {
}

const version = '{{ sdk.version }}';
const stepsToReproduce = `Running \`appwrite ${cliConfig.reportData.data.args}\``;
const stepsToReproduce = `Running \`appwrite ${cliConfig.reportData.data.args.join(' ')}\``;
const yourEnvironment = `CLI version: ${version}\nOperation System: ${os.type()}\nAppwrite version: ${appwriteVersion}\nIs Cloud: ${isCloud}`;

const stack = '```\n' + err.stack + '\n```';
Expand Down
10 changes: 5 additions & 5 deletions templates/cli/lib/questions.js.twig
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ const questionsInitProject = [
]
},
{
type: "list",
type: "search-list",
name: "organization",
message: "Choose the project organization",
choices: async () => {
Expand Down Expand Up @@ -181,7 +181,7 @@ const questionsInitProject = [
when: (answer) => answer.start === 'new'
},
{
type: "list",
type: "search-list",
name: "project",
message: "Choose your {{ spec.title|caseUcfirst }} project.",
choices: async (answers) => {
Expand Down Expand Up @@ -292,7 +292,7 @@ const questionsCreateFunction = [
const questionsCreateFunctionSelectTemplate = (templates) => {
return [
{
type: "list",
type: "search-list",
name: "template",
message: "What template would you like to use?",
choices: templates.map((template) => {
Expand Down Expand Up @@ -339,7 +339,7 @@ const questionsCreateCollection = [
}
},
{
type: "list",
type: "search-list",
name: "database",
message: "Choose the collection database",
choices: async () => {
Expand Down Expand Up @@ -472,7 +472,7 @@ const questionsLogin = [
when: (answers) => answers.method !== 'select'
},
{
type: "list",
type: "search-list",
name: "accountId",
message: "Select an account to use",
choices() {
Expand Down
1 change: 1 addition & 0 deletions templates/cli/package.json.twig
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"form-data": "^4.0.0",
"json-bigint": "^1.0.0",
"inquirer": "^8.2.4",
"inquirer-search-list": "^1.2.6",
"tar": "^6.1.11",
"ignore": "^5.2.0"
},
Expand Down
Loading