Skip to content

Commit

Permalink
Merge pull request #255 from ardriveapp/PE-1050_custom_gateway_for_re…
Browse files Browse the repository at this point in the history
…name

feat(custom gateway): Apply custom gateway to rename commands PE-1050
  • Loading branch information
fedellen authored Feb 25, 2022
2 parents 69b82db + c9e806f commit 2995cc0
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 9 deletions.
11 changes: 8 additions & 3 deletions src/commands/rename_drive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ import {
DryRunParameter,
DriveIdParameter,
DrivePrivacyParameters,
DriveNameParameter
DriveNameParameter,
GatewayParameter
} from '../parameter_declarations';
import { cliArDriveFactory } from '..';
import { SUCCESS_EXIT_CODE } from '../CLICommand/error_codes';
import { CLIAction } from '../CLICommand/action';
import { EID, Wallet } from 'ardrive-core-js';
import { getArweaveFromURL } from '../utils/get_arweave_for_url';

new CLICommand({
name: 'rename-drive',
Expand All @@ -18,10 +20,12 @@ new CLICommand({
{ name: DriveNameParameter, description: 'the new name for the drive' },
BoostParameter,
DryRunParameter,
...DrivePrivacyParameters
...DrivePrivacyParameters,
GatewayParameter
],
action: new CLIAction(async function action(options) {
const parameters = new ParametersHelper(options);
const arweave = getArweaveFromURL(parameters.getGateway());

const dryRun = parameters.isDryRun();
const driveId = parameters.getRequiredParameterValue(DriveIdParameter, EID);
Expand All @@ -31,7 +35,8 @@ new CLICommand({
const ardrive = cliArDriveFactory({
wallet,
feeMultiple: parameters.getOptionalBoostSetting(),
dryRun
dryRun,
arweave
});

const result = await (async function () {
Expand Down
17 changes: 14 additions & 3 deletions src/commands/rename_file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,28 @@ import {
DryRunParameter,
FileIdParameter,
DrivePrivacyParameters,
FileNameParameter
FileNameParameter,
GatewayParameter
} from '../parameter_declarations';
import { cliArDriveFactory } from '..';
import { SUCCESS_EXIT_CODE } from '../CLICommand/error_codes';
import { CLIAction } from '../CLICommand/action';
import { EID, Wallet } from 'ardrive-core-js';
import { getArweaveFromURL } from '../utils/get_arweave_for_url';

new CLICommand({
name: 'rename-file',
parameters: [FileIdParameter, FileNameParameter, BoostParameter, DryRunParameter, ...DrivePrivacyParameters],
parameters: [
FileIdParameter,
FileNameParameter,
BoostParameter,
DryRunParameter,
...DrivePrivacyParameters,
GatewayParameter
],
action: new CLIAction(async function action(options) {
const parameters = new ParametersHelper(options);
const arweave = getArweaveFromURL(parameters.getGateway());

const dryRun = parameters.isDryRun();
const fileId = parameters.getRequiredParameterValue(FileIdParameter, EID);
Expand All @@ -25,7 +35,8 @@ new CLICommand({
const ardrive = cliArDriveFactory({
wallet: wallet,
feeMultiple: parameters.getOptionalBoostSetting(),
dryRun
dryRun,
arweave
});

const result = await (async function () {
Expand Down
18 changes: 15 additions & 3 deletions src/commands/rename_folder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,30 @@ import {
DryRunParameter,
FolderIdParameter,
DrivePrivacyParameters,
FolderNameParameter
FolderNameParameter,
GatewayParameter
} from '../parameter_declarations';
import { cliArDriveFactory } from '..';
import { SUCCESS_EXIT_CODE } from '../CLICommand/error_codes';
import { CLIAction } from '../CLICommand/action';
import { EID, Wallet } from 'ardrive-core-js';
import { getArweaveFromURL } from '../utils/get_arweave_for_url';

new CLICommand({
name: 'rename-folder',
parameters: [FolderIdParameter, FolderNameParameter, BoostParameter, DryRunParameter, ...DrivePrivacyParameters],
parameters: [
FolderIdParameter,
FolderNameParameter,
BoostParameter,
DryRunParameter,
...DrivePrivacyParameters,
GatewayParameter
],
action: new CLIAction(async function action(options) {
const parameters = new ParametersHelper(options);

const arweave = getArweaveFromURL(parameters.getGateway());

const dryRun = parameters.isDryRun();
const folderId = parameters.getRequiredParameterValue(FolderIdParameter, EID);
const newName = parameters.getRequiredParameterValue(FolderNameParameter);
Expand All @@ -25,7 +36,8 @@ new CLICommand({
const ardrive = cliArDriveFactory({
wallet: wallet,
feeMultiple: parameters.getOptionalBoostSetting(),
dryRun
dryRun,
arweave
});

const result = await (async function () {
Expand Down

0 comments on commit 2995cc0

Please sign in to comment.