filecoin-pin
Version:
Bridge IPFS content to Filecoin Onchain Cloud using familiar tools
64 lines • 2.38 kB
TypeScript
/**
* Shared CLI options for commands
*
* This module provides reusable option definitions for Commander.js commands
* to ensure consistency across all CLI commands.
*/
import { type Command } from 'commander';
/**
* Decorator to add common authentication options to a Commander command
*
* This adds the standard set of authentication options that all commands need:
* - --private-key for standard authentication
* - --wallet-address for session key authentication
* - --session-key for session key authentication
* - --network for network selection (mainnet or calibration)
* - --rpc-url for network configuration (overrides --network)
*
* The function modifies the command in-place and returns it for chaining.
*
* @param command - The Commander command to add options to
* @returns The same command with options added (for chaining)
*
* @example
* ```typescript
* // Define command with its specific options and action
* const myCommand = new Command('mycommand')
* .description('Do something')
* .option('--my-option <value>', 'My custom option')
* .action(async (options) => {
* // options will include: privateKey, walletAddress, sessionKey, network, rpcUrl, myOption
* const { privateKey, walletAddress, sessionKey, network, rpcUrl, myOption } = options
* })
*
* // Add authentication options after the command is fully defined
* addAuthOptions(myCommand)
* ```
*/
export declare function addAuthOptions(command: Command): Command;
/**
* Decorator to add provider selection options to a Commander command
*
* This adds options for overriding the automatic provider selection:
* - --provider-address for selecting by provider address
* - --provider-id for selecting by provider ID
*
* The function modifies the command in-place and returns it for chaining.
*
* @param command - The Commander command to add options to
* @returns The same command with options added (for chaining)
*
* @example
* ```typescript
* const myCommand = new Command('upload')
* .description('Upload data')
* .action(async (options) => {
* const { providerAddress, providerId } = options
* })
*
* addProviderOptions(myCommand)
* ```
*/
export declare function addProviderOptions(command: Command): Command;
export declare function addNetworkOptions(command: Command): Command;
//# sourceMappingURL=cli-options.d.ts.map