@xano/cli 1.0.2-beta.0 → 1.0.2-beta.1
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 +2 -1
- package/dist/commands/branch/list/index.d.ts +8 -0
- package/dist/commands/branch/list/index.js +16 -1
- package/oclif.manifest.json +1769 -1761
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -151,9 +151,10 @@ All branch commands use **branch labels** (e.g., `v1`, `dev`), not IDs.
|
|
|
151
151
|
The `v1` branch is the default branch and always exists. It cannot be created, edited, or deleted.
|
|
152
152
|
|
|
153
153
|
```bash
|
|
154
|
-
# List branches
|
|
154
|
+
# List branches (backup branches are hidden by default)
|
|
155
155
|
xano branch list
|
|
156
156
|
xano branch list -w <workspace_id>
|
|
157
|
+
xano branch list --backups # include backup branches
|
|
157
158
|
|
|
158
159
|
# Get branch details
|
|
159
160
|
xano branch get <branch_label>
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import BaseCommand from '../../../base-command.js';
|
|
2
|
+
export interface Branch {
|
|
3
|
+
backup: boolean;
|
|
4
|
+
created_at: string;
|
|
5
|
+
label: string;
|
|
6
|
+
live: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function filterBackups(branches: Branch[], includeBackups: boolean): Branch[];
|
|
2
9
|
export default class BranchList extends BaseCommand {
|
|
3
10
|
static description: string;
|
|
4
11
|
static examples: string[];
|
|
5
12
|
static flags: {
|
|
13
|
+
backups: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
6
14
|
output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
15
|
workspace: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
16
|
config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
@@ -2,6 +2,9 @@ import { Flags } from '@oclif/core';
|
|
|
2
2
|
import * as yaml from 'js-yaml';
|
|
3
3
|
import * as fs from 'node:fs';
|
|
4
4
|
import BaseCommand from '../../../base-command.js';
|
|
5
|
+
export function filterBackups(branches, includeBackups) {
|
|
6
|
+
return includeBackups ? branches : branches.filter((b) => !b.backup);
|
|
7
|
+
}
|
|
5
8
|
export default class BranchList extends BaseCommand {
|
|
6
9
|
static description = 'List all branches in a workspace';
|
|
7
10
|
static examples = [
|
|
@@ -15,6 +18,12 @@ Available branches:
|
|
|
15
18
|
Available branches:
|
|
16
19
|
- v1 (live)
|
|
17
20
|
- feature-auth
|
|
21
|
+
`,
|
|
22
|
+
`$ xano branch list --backups
|
|
23
|
+
Available branches:
|
|
24
|
+
- v1 (live)
|
|
25
|
+
- dev
|
|
26
|
+
- backup_2024_01_15 (backup)
|
|
18
27
|
`,
|
|
19
28
|
`$ xano branch list --output json
|
|
20
29
|
[
|
|
@@ -29,6 +38,11 @@ Available branches:
|
|
|
29
38
|
];
|
|
30
39
|
static flags = {
|
|
31
40
|
...BaseCommand.baseFlags,
|
|
41
|
+
backups: Flags.boolean({
|
|
42
|
+
default: false,
|
|
43
|
+
description: 'Include backup branches in the output',
|
|
44
|
+
required: false,
|
|
45
|
+
}),
|
|
32
46
|
output: Flags.string({
|
|
33
47
|
char: 'o',
|
|
34
48
|
default: 'summary',
|
|
@@ -82,7 +96,8 @@ Available branches:
|
|
|
82
96
|
const errorText = await response.text();
|
|
83
97
|
this.error(`API request failed with status ${response.status}: ${response.statusText}\n${errorText}`);
|
|
84
98
|
}
|
|
85
|
-
const
|
|
99
|
+
const allBranches = await response.json();
|
|
100
|
+
const branches = filterBackups(allBranches, flags.backups);
|
|
86
101
|
// Output results
|
|
87
102
|
if (flags.output === 'json') {
|
|
88
103
|
this.log(JSON.stringify(branches, null, 2));
|