Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

Move template commands to the top command

Tomas Valenta3dbe7017e896
diff --git a/packages/cli/src/commands/template/build.ts b/packages/cli/src/commands/build.ts
similarity index 100%
rename from packages/cli/src/commands/template/build.ts
rename to packages/cli/src/commands/build.ts
diff --git a/packages/cli/src/commands/index.ts b/packages/cli/src/commands/index.ts
index d10d9b3d4..8d94549bf 100644
--- a/packages/cli/src/commands/index.ts
+++ b/packages/cli/src/commands/index.ts
@@ -2,10 +2,21 @@ import * as commander from 'commander'
import { loginCommand } from './login'
import { logoutCommand } from './logout'
-import { templateCommand } from './template'
+import { buildCommand } from './build'
+import { listCommand } from './list'
+import { shellCommand } from './shell'
+import { initCommand } from './init'
+import { asPrimary } from 'src/utils/format'
+
export const program = new commander.Command()
- .description('Tool for interacting with E2B from command line')
- .addCommand(templateCommand, { isDefault: true })
+ .description(`Create sandbox templates from Dockerfiles by running ${asPrimary('e2b build')} then use our SDKs to create sandboxes from these templates.
+
+Visit ${asPrimary('E2B docs (https://e2b.dev/docs)')} to learn how to create sandbox templates and start sandboxes.
+`)
.addCommand(loginCommand)
.addCommand(logoutCommand)
+ .addCommand(buildCommand)
+ .addCommand(listCommand)
+ .addCommand(shellCommand)
+ .addCommand(initCommand)
\ No newline at end of file
diff --git a/packages/cli/src/commands/template/init.ts b/packages/cli/src/commands/init.ts
similarity index 100%
rename from packages/cli/src/commands/template/init.ts
rename to packages/cli/src/commands/init.ts
diff --git a/packages/cli/src/commands/template/list.ts b/packages/cli/src/commands/list.ts
similarity index 96%
rename from packages/cli/src/commands/template/list.ts
rename to packages/cli/src/commands/list.ts
index 02046fba2..65b39d75e 100644
--- a/packages/cli/src/commands/template/list.ts
+++ b/packages/cli/src/commands/list.ts
@@ -3,7 +3,7 @@ import * as commander from 'commander'
import * as e2b from '@e2b/sdk'
import { ensureAccessToken } from 'src/api'
-import { listAliases } from '../../utils/format'
+import { listAliases } from '../utils/format'
const listTemplates = e2b.withAccessToken(
e2b.api.path('/envs').method('get').create(),
diff --git a/packages/cli/src/commands/template/shell.ts b/packages/cli/src/commands/shell.ts
similarity index 93%
rename from packages/cli/src/commands/template/shell.ts
rename to packages/cli/src/commands/shell.ts
index 7ff339f90..a6a839b4a 100644
--- a/packages/cli/src/commands/template/shell.ts
+++ b/packages/cli/src/commands/shell.ts
@@ -4,10 +4,10 @@ import * as commander from 'commander'
import { ensureAPIKey } from 'src/api'
import { spawnConnectedTerminal } from 'src/terminal'
import { asBold, asFormattedSandboxTemplate } from 'src/utils/format'
-import { getRoot } from '../../utils/filesystem'
-import { getConfigPath, loadConfig } from '../../config'
+import { getRoot } from '../utils/filesystem'
+import { getConfigPath, loadConfig } from '../config'
import fs from 'fs'
-import { pathOption } from '../../options'
+import { pathOption } from '../options'
import path from 'path'
export const shellCommand = new commander.Command('shell')
@@ -64,9 +64,9 @@ export const shellCommand = new commander.Command('shell')
})
async function connectSandbox({
- apiKey,
- template,
- }: {
+ apiKey,
+ template,
+}: {
apiKey: string;
template: Pick<e2b.components['schemas']['Environment'], 'envID'>;
}) {
diff --git a/packages/cli/src/commands/template/index.ts b/packages/cli/src/commands/template/index.ts
deleted file mode 100644
index 1d71aa8d5..000000000
--- a/packages/cli/src/commands/template/index.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-import * as commander from 'commander'
-
-import { buildCommand } from './build'
-import { listCommand } from './list'
-import { shellCommand } from './shell'
-import { initCommand } from './init'
-import { asPrimary } from 'src/utils/format'
-
-export const templateCommand = new commander.Command('template')
- .description(`Create sandbox templates from Dockerfiles by running ${asPrimary('e2b build')} then use our SDKs to create sandboxes from these templates.
-
-Visit ${asPrimary('E2B docs (https://e2b.dev/docs)')} to learn how to create sandbox templates and start sandboxes.
-`)
- .addCommand(buildCommand)
- .addCommand(listCommand)
- .addCommand(shellCommand)
- .addCommand(initCommand)