Skip to content
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
50 changes: 25 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ $ npm install -g @internxt/cli
$ internxt COMMAND
running command...
$ internxt (--version)
@internxt/cli/1.5.2 win32-x64 node-v23.7.0
@internxt/cli/1.5.3 win32-x64 node-v23.7.0
$ internxt --help [COMMAND]
USAGE
$ internxt COMMAND
Expand Down Expand Up @@ -99,7 +99,7 @@ EXAMPLES
$ internxt add-cert
```

_See code: [src/commands/add-cert.ts](https://github.com/internxt/cli/blob/v1.5.2/src/commands/add-cert.ts)_
_See code: [src/commands/add-cert.ts](https://github.com/internxt/cli/blob/v1.5.3/src/commands/add-cert.ts)_

## `internxt config`

Expand All @@ -119,7 +119,7 @@ EXAMPLES
$ internxt config
```

_See code: [src/commands/config.ts](https://github.com/internxt/cli/blob/v1.5.2/src/commands/config.ts)_
_See code: [src/commands/config.ts](https://github.com/internxt/cli/blob/v1.5.3/src/commands/config.ts)_

## `internxt create-folder`

Expand Down Expand Up @@ -148,7 +148,7 @@ EXAMPLES
$ internxt create-folder
```

_See code: [src/commands/create-folder.ts](https://github.com/internxt/cli/blob/v1.5.2/src/commands/create-folder.ts)_
_See code: [src/commands/create-folder.ts](https://github.com/internxt/cli/blob/v1.5.3/src/commands/create-folder.ts)_

## `internxt delete-permanently-file`

Expand Down Expand Up @@ -178,7 +178,7 @@ EXAMPLES
$ internxt delete-permanently-file
```

_See code: [src/commands/delete-permanently-file.ts](https://github.com/internxt/cli/blob/v1.5.2/src/commands/delete-permanently-file.ts)_
_See code: [src/commands/delete-permanently-file.ts](https://github.com/internxt/cli/blob/v1.5.3/src/commands/delete-permanently-file.ts)_

## `internxt delete-permanently-folder`

Expand Down Expand Up @@ -208,7 +208,7 @@ EXAMPLES
$ internxt delete-permanently-folder
```

_See code: [src/commands/delete-permanently-folder.ts](https://github.com/internxt/cli/blob/v1.5.2/src/commands/delete-permanently-folder.ts)_
_See code: [src/commands/delete-permanently-folder.ts](https://github.com/internxt/cli/blob/v1.5.3/src/commands/delete-permanently-folder.ts)_

## `internxt delete permanently file`

Expand Down Expand Up @@ -297,7 +297,7 @@ EXAMPLES
$ internxt download-file
```

_See code: [src/commands/download-file.ts](https://github.com/internxt/cli/blob/v1.5.2/src/commands/download-file.ts)_
_See code: [src/commands/download-file.ts](https://github.com/internxt/cli/blob/v1.5.3/src/commands/download-file.ts)_

## `internxt download file`

Expand Down Expand Up @@ -356,7 +356,7 @@ EXAMPLES
$ internxt list
```

_See code: [src/commands/list.ts](https://github.com/internxt/cli/blob/v1.5.2/src/commands/list.ts)_
_See code: [src/commands/list.ts](https://github.com/internxt/cli/blob/v1.5.3/src/commands/list.ts)_

## `internxt login`

Expand Down Expand Up @@ -385,7 +385,7 @@ EXAMPLES
$ internxt login
```

_See code: [src/commands/login.ts](https://github.com/internxt/cli/blob/v1.5.2/src/commands/login.ts)_
_See code: [src/commands/login.ts](https://github.com/internxt/cli/blob/v1.5.3/src/commands/login.ts)_

## `internxt logout`

Expand All @@ -405,7 +405,7 @@ EXAMPLES
$ internxt logout
```

_See code: [src/commands/logout.ts](https://github.com/internxt/cli/blob/v1.5.2/src/commands/logout.ts)_
_See code: [src/commands/logout.ts](https://github.com/internxt/cli/blob/v1.5.3/src/commands/logout.ts)_

## `internxt logs`

Expand All @@ -425,7 +425,7 @@ EXAMPLES
$ internxt logs
```

_See code: [src/commands/logs.ts](https://github.com/internxt/cli/blob/v1.5.2/src/commands/logs.ts)_
_See code: [src/commands/logs.ts](https://github.com/internxt/cli/blob/v1.5.3/src/commands/logs.ts)_

## `internxt move-file`

Expand Down Expand Up @@ -457,7 +457,7 @@ EXAMPLES
$ internxt move-file
```

_See code: [src/commands/move-file.ts](https://github.com/internxt/cli/blob/v1.5.2/src/commands/move-file.ts)_
_See code: [src/commands/move-file.ts](https://github.com/internxt/cli/blob/v1.5.3/src/commands/move-file.ts)_

## `internxt move-folder`

Expand Down Expand Up @@ -489,7 +489,7 @@ EXAMPLES
$ internxt move-folder
```

_See code: [src/commands/move-folder.ts](https://github.com/internxt/cli/blob/v1.5.2/src/commands/move-folder.ts)_
_See code: [src/commands/move-folder.ts](https://github.com/internxt/cli/blob/v1.5.3/src/commands/move-folder.ts)_

## `internxt move file`

Expand Down Expand Up @@ -580,7 +580,7 @@ EXAMPLES
$ internxt rename-file
```

_See code: [src/commands/rename-file.ts](https://github.com/internxt/cli/blob/v1.5.2/src/commands/rename-file.ts)_
_See code: [src/commands/rename-file.ts](https://github.com/internxt/cli/blob/v1.5.3/src/commands/rename-file.ts)_

## `internxt rename-folder`

Expand Down Expand Up @@ -611,7 +611,7 @@ EXAMPLES
$ internxt rename-folder
```

_See code: [src/commands/rename-folder.ts](https://github.com/internxt/cli/blob/v1.5.2/src/commands/rename-folder.ts)_
_See code: [src/commands/rename-folder.ts](https://github.com/internxt/cli/blob/v1.5.3/src/commands/rename-folder.ts)_

## `internxt rename file`

Expand Down Expand Up @@ -699,7 +699,7 @@ EXAMPLES
$ internxt trash-clear
```

_See code: [src/commands/trash-clear.ts](https://github.com/internxt/cli/blob/v1.5.2/src/commands/trash-clear.ts)_
_See code: [src/commands/trash-clear.ts](https://github.com/internxt/cli/blob/v1.5.3/src/commands/trash-clear.ts)_

## `internxt trash-file`

Expand Down Expand Up @@ -729,7 +729,7 @@ EXAMPLES
$ internxt trash-file
```

_See code: [src/commands/trash-file.ts](https://github.com/internxt/cli/blob/v1.5.2/src/commands/trash-file.ts)_
_See code: [src/commands/trash-file.ts](https://github.com/internxt/cli/blob/v1.5.3/src/commands/trash-file.ts)_

## `internxt trash-folder`

Expand Down Expand Up @@ -759,7 +759,7 @@ EXAMPLES
$ internxt trash-folder
```

_See code: [src/commands/trash-folder.ts](https://github.com/internxt/cli/blob/v1.5.2/src/commands/trash-folder.ts)_
_See code: [src/commands/trash-folder.ts](https://github.com/internxt/cli/blob/v1.5.3/src/commands/trash-folder.ts)_

## `internxt trash-list`

Expand All @@ -785,7 +785,7 @@ EXAMPLES
$ internxt trash-list
```

_See code: [src/commands/trash-list.ts](https://github.com/internxt/cli/blob/v1.5.2/src/commands/trash-list.ts)_
_See code: [src/commands/trash-list.ts](https://github.com/internxt/cli/blob/v1.5.3/src/commands/trash-list.ts)_

## `internxt trash-restore-file`

Expand Down Expand Up @@ -816,7 +816,7 @@ EXAMPLES
$ internxt trash-restore-file
```

_See code: [src/commands/trash-restore-file.ts](https://github.com/internxt/cli/blob/v1.5.2/src/commands/trash-restore-file.ts)_
_See code: [src/commands/trash-restore-file.ts](https://github.com/internxt/cli/blob/v1.5.3/src/commands/trash-restore-file.ts)_

## `internxt trash-restore-folder`

Expand Down Expand Up @@ -847,7 +847,7 @@ EXAMPLES
$ internxt trash-restore-folder
```

_See code: [src/commands/trash-restore-folder.ts](https://github.com/internxt/cli/blob/v1.5.2/src/commands/trash-restore-folder.ts)_
_See code: [src/commands/trash-restore-folder.ts](https://github.com/internxt/cli/blob/v1.5.3/src/commands/trash-restore-folder.ts)_

## `internxt trash clear`

Expand Down Expand Up @@ -1044,7 +1044,7 @@ EXAMPLES
$ internxt upload-file
```

_See code: [src/commands/upload-file.ts](https://github.com/internxt/cli/blob/v1.5.2/src/commands/upload-file.ts)_
_See code: [src/commands/upload-file.ts](https://github.com/internxt/cli/blob/v1.5.3/src/commands/upload-file.ts)_

## `internxt upload file`

Expand Down Expand Up @@ -1099,7 +1099,7 @@ EXAMPLES
$ internxt webdav status
```

_See code: [src/commands/webdav.ts](https://github.com/internxt/cli/blob/v1.5.2/src/commands/webdav.ts)_
_See code: [src/commands/webdav.ts](https://github.com/internxt/cli/blob/v1.5.3/src/commands/webdav.ts)_

## `internxt webdav-config`

Expand All @@ -1125,7 +1125,7 @@ EXAMPLES
$ internxt webdav-config
```

_See code: [src/commands/webdav-config.ts](https://github.com/internxt/cli/blob/v1.5.2/src/commands/webdav-config.ts)_
_See code: [src/commands/webdav-config.ts](https://github.com/internxt/cli/blob/v1.5.3/src/commands/webdav-config.ts)_

## `internxt whoami`

Expand All @@ -1145,7 +1145,7 @@ EXAMPLES
$ internxt whoami
```

_See code: [src/commands/whoami.ts](https://github.com/internxt/cli/blob/v1.5.2/src/commands/whoami.ts)_
_See code: [src/commands/whoami.ts](https://github.com/internxt/cli/blob/v1.5.3/src/commands/whoami.ts)_
<!-- commandsstop -->

# Current Limitations
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"author": "Internxt <hello@internxt.com>",
"version": "1.5.2",
"version": "1.5.3",
"description": "Internxt CLI to manage your encrypted storage",
"scripts": {
"build": "yarn clean && tsc",
Expand Down
47 changes: 24 additions & 23 deletions src/commands/add-cert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { ConfigService } from '../services/config.service';
import os from 'node:os';
import path from 'node:path';
import { CLIUtils } from '../utils/cli.utils';
import { ErrorUtils } from '../utils/errors.utils';

export default class AddCert extends Command {
static readonly args = {};
Expand All @@ -15,34 +14,36 @@ export default class AddCert extends Command {
static readonly enableJsonFlag = true;

public run = async () => {
try {
const certPath = path.join(ConfigService.WEBDAV_SSL_CERTS_DIR, 'cert.crt');
const platform = os.platform();
const certPath = path.join(ConfigService.WEBDAV_SSL_CERTS_DIR, 'cert.crt');
const platform = os.platform();

const scriptBasePath = path.join(__dirname, '../../scripts');
let command = '';
const scriptBasePath = path.join(__dirname, '../../scripts');
let command = '';

if (platform === 'win32') {
// eslint-disable-next-line max-len
command = `powershell -ExecutionPolicy Bypass -File "${path.join(scriptBasePath, 'add-cert.ps1')}" -certPath "${certPath}"`;
} else if (platform === 'darwin' || platform === 'linux') {
command = `bash "${path.join(scriptBasePath, 'add-cert.sh')}" "${certPath}"`;
} else {
throw new Error(`Unsupported OS: ${platform}`);
}

await this.executeCommand(command);
const message = 'Certificate successfully added to the trusted store.';
CLIUtils.success(this.log.bind(this), message);
return { success: true, message };
} catch (error) {
await this.catch(error as Error);
if (platform === 'win32') {
// eslint-disable-next-line max-len
command = `powershell -ExecutionPolicy Bypass -File "${path.join(scriptBasePath, 'add-cert.ps1')}" -certPath "${certPath}"`;
} else if (platform === 'darwin' || platform === 'linux') {
command = `bash "${path.join(scriptBasePath, 'add-cert.sh')}" "${certPath}"`;
} else {
throw new Error(`Unsupported OS: ${platform}`);
}

await this.executeCommand(command);
const message = 'Certificate successfully added to the trusted store.';
CLIUtils.success(this.log.bind(this), message);
return { success: true, message };
};

public catch = async (error: Error) => {
ErrorUtils.report(this.error.bind(this), error, { command: this.id });
CLIUtils.error(this.log.bind(this), error.message);
const { flags } = await this.parse(AddCert);
CLIUtils.catchError({
error,
command: this.id,
logReporter: this.log.bind(this),
errorReporter: this.error.bind(this),
jsonFlag: flags['json'],
});
this.exit(1);
};

Expand Down
11 changes: 8 additions & 3 deletions src/commands/config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Command } from '@oclif/core';
import { ConfigService } from '../services/config.service';
import { CLIUtils } from '../utils/cli.utils';
import { ErrorUtils } from '../utils/errors.utils';
import { UsageService } from '../services/usage.service';
import { FormatUtils } from '../utils/format.utils';
import { Header } from 'tty-table';
Expand Down Expand Up @@ -41,8 +40,14 @@ export default class Config extends Command {
};

public catch = async (error: Error) => {
ErrorUtils.report(this.error.bind(this), error, { command: this.id });
CLIUtils.error(this.log.bind(this), error.message);
const { flags } = await this.parse(Config);
CLIUtils.catchError({
error,
command: this.id,
logReporter: this.log.bind(this),
errorReporter: this.error.bind(this),
jsonFlag: flags['json'],
});
this.exit(1);
};
}
15 changes: 10 additions & 5 deletions src/commands/create-folder.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Command, Flags } from '@oclif/core';
import { ErrorUtils } from '../utils/errors.utils';
import { CLIUtils } from '../utils/cli.utils';
import { DriveFolderService } from '../services/drive/drive-folder.service';
import { ConfigService } from '../services/config.service';
Expand Down Expand Up @@ -42,7 +41,7 @@ export default class CreateFolder extends Command {
folderUuid = userCredentials.user.rootFolderId;
}

CLIUtils.doing('Creating folder...');
CLIUtils.doing('Creating folder...', flags['json']);
const [createNewFolder, requestCanceler] = DriveFolderService.instance.createFolder({
plainName: folderName,
parentFolderUuid: folderUuid,
Expand All @@ -54,16 +53,22 @@ export default class CreateFolder extends Command {
});

const newFolder = await createNewFolder;
CLIUtils.done();
CLIUtils.done(flags['json']);
// eslint-disable-next-line max-len
const message = `Folder ${newFolder.plainName} created successfully, view it at ${ConfigService.instance.get('DRIVE_URL')}/folder/${newFolder.uuid}`;
CLIUtils.success(this.log.bind(this), message);
return { success: true, message, folder: newFolder };
};

public catch = async (error: Error) => {
ErrorUtils.report(this.error.bind(this), error, { command: this.id });
CLIUtils.error(this.log.bind(this), error.message);
const { flags } = await this.parse(CreateFolder);
CLIUtils.catchError({
error,
command: this.id,
logReporter: this.log.bind(this),
errorReporter: this.error.bind(this),
jsonFlag: flags['json'],
});
this.exit(1);
};

Expand Down
11 changes: 8 additions & 3 deletions src/commands/delete-permanently-file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { CLIUtils } from '../utils/cli.utils';
import { MissingCredentialsError, NotValidFileUuidError } from '../types/command.types';
import { ValidationService } from '../services/validation.service';
import { DriveFileService } from '../services/drive/drive-file.service';
import { ErrorUtils } from '../utils/errors.utils';
import { TrashService } from '../services/drive/trash.service';

export default class DeletePermanentlyFile extends Command {
Expand Down Expand Up @@ -43,8 +42,14 @@ export default class DeletePermanentlyFile extends Command {
};

public catch = async (error: Error) => {
ErrorUtils.report(this.error.bind(this), error, { command: this.id });
CLIUtils.error(this.log.bind(this), error.message);
const { flags } = await this.parse(DeletePermanentlyFile);
CLIUtils.catchError({
error,
command: this.id,
logReporter: this.log.bind(this),
errorReporter: this.error.bind(this),
jsonFlag: flags['json'],
});
this.exit(1);
};

Expand Down
Loading
Loading