@zenifra/cli 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/bin/zenifra.mjs +15 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -56,7 +56,7 @@ zenifra create project --name <name> --plan free --payment-mode hourly --config
|
|
|
56
56
|
zenifra create project --name <name> --plan basic --payment-mode hourly --config @examples/http-github-project.json
|
|
57
57
|
zenifra create project --name <name> --plan db-basic --payment-mode monthly --config @examples/postgresql-project.json
|
|
58
58
|
zenifra create project --name <name> --plan db-basic --payment-mode monthly --config @examples/mariadb-project.json
|
|
59
|
-
zenifra projects --type http
|
|
59
|
+
zenifra projects --type http --page 1 --limit 15
|
|
60
60
|
zenifra project info --project <project-id>
|
|
61
61
|
zenifra project url --project <project-id>
|
|
62
62
|
zenifra project logs --project <project-id> --instance <instance-id>
|
|
@@ -83,7 +83,7 @@ zenifra deploy watch --project <project-id> --build <build-id>
|
|
|
83
83
|
- Store local de perfis: `~/.config/zenifra-cli/profiles.json`
|
|
84
84
|
- Override do diretorio local: `ZENIFRA_CONFIG_DIR=/path/custom`
|
|
85
85
|
|
|
86
|
-
Todos os comandos de listagem aceitam `--json`.
|
|
86
|
+
Todos os comandos de listagem aceitam `--json`. `zenifra projects` e paginado por padrao com 15 itens por pagina; use `--page <n>` e `--limit <n>` para navegar.
|
|
87
87
|
|
|
88
88
|
Para comparar custo antes de criar um projeto, use:
|
|
89
89
|
|
|
@@ -137,7 +137,7 @@ Crie uma API key global no painel da organizacao e use-a em jobs, pipelines e sc
|
|
|
137
137
|
|
|
138
138
|
```bash
|
|
139
139
|
export ZENIFRA_API_KEY=znf_sua_chave
|
|
140
|
-
zenifra projects --type http
|
|
140
|
+
zenifra projects --type http --page 1 --limit 15
|
|
141
141
|
zenifra deploy --project <project-id> --branch main
|
|
142
142
|
```
|
|
143
143
|
|
package/bin/zenifra.mjs
CHANGED
|
@@ -108,7 +108,7 @@ Usage:
|
|
|
108
108
|
zenifra plans [--type <all|http|database|storage>] [--json]
|
|
109
109
|
zenifra create project
|
|
110
110
|
zenifra create project --name <name> --plan <plan> --payment-mode <mode> --config <json|@file> [--description <text>] [--org <id>] [--json]
|
|
111
|
-
zenifra projects [--json] [--org <id>] [--type <http|postgresql|mariadb>]
|
|
111
|
+
zenifra projects [--json] [--org <id>] [--type <http|postgresql|mariadb>] [--page <n>] [--limit <n>]
|
|
112
112
|
zenifra project info --project <id> [--json]
|
|
113
113
|
zenifra project url --project <id> [--json]
|
|
114
114
|
zenifra project logs --project <id> [--instance <id>] [--json]
|
|
@@ -272,12 +272,12 @@ const HELP_SPECS = [
|
|
|
272
272
|
},
|
|
273
273
|
{
|
|
274
274
|
command: 'projects',
|
|
275
|
-
usage: 'zenifra projects [--json] [--org <id>] [--type <http|postgresql|mariadb>]',
|
|
275
|
+
usage: 'zenifra projects [--json] [--org <id>] [--type <http|postgresql|mariadb>] [--page <n>] [--limit <n>]',
|
|
276
276
|
description: 'Lista projetos da organizacao ativa ou da API key.',
|
|
277
|
-
flags: ['--json
|
|
278
|
-
examples: ['zenifra projects --type http', 'zenifra projects --json'],
|
|
277
|
+
flags: ['--json Imprime a resposta em JSON.', '--org <id> Usa uma organizacao especifica com sessao de usuario.', '--type <type> Filtra por tipo de projeto.', '--page <n> Pagina. Padrao: 1.', '--limit <n> Itens por pagina. Padrao: 15.'],
|
|
278
|
+
examples: ['zenifra projects --type http --page 1 --limit 15', 'zenifra projects --json'],
|
|
279
279
|
output: 'ID Nome Status Plano Tipo\n507f1f77bcf86cd799439012 api-web running free http',
|
|
280
|
-
jsonOutput: '[{"id":"507f1f77bcf86cd799439012","name":"api-web","status":"running","type_project":"http"}]',
|
|
280
|
+
jsonOutput: '{"projects":[{"id":"507f1f77bcf86cd799439012","name":"api-web","status":"running","type_project":"http"}],"pagination":{"page":1,"limit":15,"total":1,"pages":1}}',
|
|
281
281
|
},
|
|
282
282
|
{
|
|
283
283
|
command: 'create project',
|
|
@@ -1636,7 +1636,12 @@ async function handleOrgSet(session, flags) {
|
|
|
1636
1636
|
|
|
1637
1637
|
async function handleProjects(session, flags) {
|
|
1638
1638
|
const orgId = await resolveOrgId(session, flags);
|
|
1639
|
-
const
|
|
1639
|
+
const projectFlags = {
|
|
1640
|
+
...flags,
|
|
1641
|
+
page: flags.page ?? 1,
|
|
1642
|
+
limit: flags.limit ?? 15,
|
|
1643
|
+
};
|
|
1644
|
+
const query = buildQuery(projectFlags, ['type', 'page', 'limit']);
|
|
1640
1645
|
const data = unwrapData(await request(session, flags, 'GET', `/project${query}`, { orgId }));
|
|
1641
1646
|
const projects = asArray(data);
|
|
1642
1647
|
|
|
@@ -1648,6 +1653,10 @@ async function handleProjects(session, flags) {
|
|
|
1648
1653
|
{ label: 'Plano', value: (project) => project.plan || '-' },
|
|
1649
1654
|
{ label: 'Tipo', value: (project) => project.type_project || project.config?.type_project || '-' },
|
|
1650
1655
|
]);
|
|
1656
|
+
if (data?.pagination) {
|
|
1657
|
+
const { page = 1, pages = 1, total = projects.length } = data.pagination;
|
|
1658
|
+
process.stdout.write(`\nPagina ${page} de ${Math.max(pages, 1)} (${total} projeto(s))\n`);
|
|
1659
|
+
}
|
|
1651
1660
|
}
|
|
1652
1661
|
|
|
1653
1662
|
async function parseConfig(input) {
|