UNPKG

dwnpm

Version:

Decentralized Registry Package Manager (DRPM) helps developers publish, install, find and manage Decentralized Packages (DPKs) published to Decentralized Web Nodes (DWNs). DRPM does this by looking up a Decentralized Identifier (DID) to find its DID docum

40 lines (39 loc) 1.2 kB
import { Profile } from '../../lib/profile.js'; import { Logger } from '../../utils/logger.js'; import { ICommand } from '../drpm.js'; import { DRegistryPackageManagerError } from './error.js'; export class ProfileCommand implements ICommand { async execute({ options, subcommand }: { options?: any; subcommand?: string}): Promise<void> { try { const profile = new Profile(options?.name); switch (subcommand) { case 'read': await profile.read(options); break; case 'add': await profile.add(options); break; case 'delete': await profile.delete(options); break; case 'list': await profile.list(); break; case 'switch': await profile.switch(options); break; case 'recover': await Profile.recover(options); break; case 'backup': await profile.backup(options); break; default: throw new DRegistryPackageManagerError(`ProfileCommand: Unknown subcommand ${subcommand}`); } } catch (error: any) { Logger.error(error.message); throw error; } } }