Enum anchor_cli::Command

source ·
pub enum Command {
Show 19 variants Init { name: String, javascript: bool, no_git: bool, jest: bool, }, Build { idl: Option<String>, skip_lint: bool, idl_ts: Option<String>, verifiable: bool, program_name: Option<String>, solana_version: Option<String>, docker_image: Option<String>, bootstrap: BootstrapMode, env: Vec<String>, cargo_args: Vec<String>, no_docs: bool, arch: ProgramArch, }, Expand { program_name: Option<String>, cargo_args: Vec<String>, }, Verify { program_id: Pubkey, program_name: Option<String>, solana_version: Option<String>, docker_image: Option<String>, bootstrap: BootstrapMode, arch: ProgramArch, env: Vec<String>, cargo_args: Vec<String>, skip_build: bool, }, Test { skip_deploy: bool, skip_lint: bool, skip_local_validator: bool, skip_build: bool, arch: ProgramArch, detach: bool, run: Vec<String>, args: Vec<String>, env: Vec<String>, cargo_args: Vec<String>, }, New { name: String, }, Idl { subcmd: IdlCommand, }, Clean, Deploy { program_name: Option<String>, program_keypair: Option<String>, }, Migrate, Upgrade { program_id: Pubkey, program_filepath: String, }, Cluster { subcmd: ClusterCommand, }, Shell, Run { script: String, script_args: Vec<String>, }, Login { token: String, }, Publish { program: String, env: Vec<String>, cargo_args: Vec<String>, skip_build: bool, arch: ProgramArch, }, Keys { subcmd: KeysCommand, }, Localnet { skip_build: bool, skip_deploy: bool, skip_lint: bool, arch: ProgramArch, env: Vec<String>, cargo_args: Vec<String>, }, Account { account_type: String, address: Pubkey, idl: Option<String>, },
}

Variants§

§

Init

Fields

§name: String
§javascript: bool
§no_git: bool
§jest: bool

Initializes a workspace.

§

Build

Fields

§idl: Option<String>

Output directory for the IDL.

§skip_lint: bool

True if the build should not fail even if there are no “CHECK” comments where normally required

§idl_ts: Option<String>

Output directory for the TypeScript IDL.

§verifiable: bool

True if the build artifact needs to be deterministic and verifiable.

§program_name: Option<String>
§solana_version: Option<String>

Version of the Solana toolchain to use. For –verifiable builds only.

§docker_image: Option<String>

Docker image to use. For –verifiable builds only.

§bootstrap: BootstrapMode

Bootstrap docker image from scratch, installing all requirements for verifiable builds. Only works for debian-based images.

§env: Vec<String>

Environment variables to pass into the docker container

§cargo_args: Vec<String>

Arguments to pass to the underlying cargo build-bpf command

§no_docs: bool

Suppress doc strings in IDL output

§arch: ProgramArch

Architecture to use when building the program

Builds the workspace.

§

Expand

Fields

§program_name: Option<String>

Expand only this program

§cargo_args: Vec<String>

Arguments to pass to the underlying cargo expand command

Expands macros (wrapper around cargo expand)

Use it in a program folder to expand program

Use it in a workspace but outside a program folder to expand the entire workspace

§

Verify

Fields

§program_id: Pubkey

The deployed program to compare against.

§program_name: Option<String>
§solana_version: Option<String>

Version of the Solana toolchain to use. For –verifiable builds only.

§docker_image: Option<String>

Docker image to use. For –verifiable builds only.

§bootstrap: BootstrapMode

Bootstrap docker image from scratch, installing all requirements for verifiable builds. Only works for debian-based images.

§arch: ProgramArch

Architecture to use when building the program

§env: Vec<String>

Environment variables to pass into the docker container

§cargo_args: Vec<String>

Arguments to pass to the underlying cargo build-bpf command.

§skip_build: bool

Flag to skip building the program in the workspace, use this to save time when running verify and the program code is already built.

Verifies the on-chain bytecode matches the locally compiled artifact. Run this command inside a program subdirectory, i.e., in the dir containing the program’s Cargo.toml.

§

Test

Fields

§skip_deploy: bool

Use this flag if you want to run tests against previously deployed programs.

§skip_lint: bool

True if the build should not fail even if there are no “CHECK” comments where normally required

§skip_local_validator: bool

Flag to skip starting a local validator, if the configured cluster url is a localnet.

§skip_build: bool

Flag to skip building the program in the workspace, use this to save time when running test and the program code is not altered.

§arch: ProgramArch

Architecture to use when building the program

§detach: bool

Flag to keep the local validator running after tests to be able to check the transactions.

§run: Vec<String>

Run the test suites under the specified path

§args: Vec<String>
§env: Vec<String>

Environment variables to pass into the docker container

§cargo_args: Vec<String>

Arguments to pass to the underlying cargo build-bpf command.

Runs integration tests against a localnetwork.

§

New

Fields

§name: String

Creates a new program.

§

Idl

Fields

§subcmd: IdlCommand

Commands for interacting with interface definitions.

§

Clean

Remove all artifacts from the target directory except program keypairs.

§

Deploy

Fields

§program_name: Option<String>

Only deploy this program

§program_keypair: Option<String>

Keypair of the program (filepath) (requires program-name)

Deploys each program in the workspace.

§

Migrate

Runs the deploy migration script.

§

Upgrade

Fields

§program_id: Pubkey

The program to upgrade.

§program_filepath: String

Filepath to the new program binary.

Deploys, initializes an IDL, and migrates all in one command. Upgrades a single program. The configured wallet must be the upgrade authority.

§

Cluster

Fields

Cluster commands.

§

Shell

Starts a node shell with an Anchor client setup according to the local config.

§

Run

Fields

§script: String

The name of the script to run.

§script_args: Vec<String>

Argument to pass to the underlying script.

Runs the script defined by the current workspace’s Anchor.toml.

§

Login

Fields

§token: String

API access token.

Saves an api token from the registry locally.

§

Publish

Fields

§program: String

The name of the program to publish.

§env: Vec<String>

Environment variables to pass into the docker container

§cargo_args: Vec<String>

Arguments to pass to the underlying cargo build-bpf command.

§skip_build: bool

Flag to skip building the program in the workspace, use this to save time when publishing the program

§arch: ProgramArch

Architecture to use when building the program

Publishes a verified build to the Anchor registry.

§

Keys

Fields

Keypair commands.

§

Localnet

Fields

§skip_build: bool

Flag to skip building the program in the workspace, use this to save time when running test and the program code is not altered.

§skip_deploy: bool

Use this flag if you want to run tests against previously deployed programs.

§skip_lint: bool

True if the build should not fail even if there are no “CHECK” comments where normally required

§arch: ProgramArch

Architecture to use when building the program

§env: Vec<String>

Environment variables to pass into the docker container

§cargo_args: Vec<String>

Arguments to pass to the underlying cargo build-bpf command.

Localnet commands.

§

Account

Fields

§account_type: String

Account struct to deserialize

§address: Pubkey

Address of the account to deserialize

§idl: Option<String>

IDL to use (defaults to workspace IDL)

Fetch and deserialize an account using the IDL provided.

Trait Implementations§

source§

impl CommandFactory for Command

source§

fn into_app<'b>() -> Command<'b>

Deprecated, replaced with CommandFactory::command
source§

fn into_app_for_update<'b>() -> Command<'b>

Deprecated, replaced with CommandFactory::command_for_update
source§

fn command<'help>() -> App<'help>

Build a Command that can instantiate Self. Read more
source§

fn command_for_update<'help>() -> App<'help>

Build a Command that can update self. Read more
source§

impl Debug for Command

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl FromArgMatches for Command

source§

fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>

Instantiate Self from ArgMatches, parsing the arguments as needed. Read more
source§

fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches ) -> Result<Self, Error>

Instantiate Self from ArgMatches, parsing the arguments as needed. Read more
source§

fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches ) -> Result<(), Error>

Assign values from ArgMatches to self.
source§

fn update_from_arg_matches_mut<'b>( &mut self, __clap_arg_matches: &mut ArgMatches ) -> Result<(), Error>

Assign values from ArgMatches to self.
source§

impl Parser for Command

source§

fn parse() -> Self

Parse from std::env::args_os(), exit on error
source§

fn try_parse() -> Result<Self, Error>

Parse from std::env::args_os(), return Err on error.
source§

fn parse_from<I, T>(itr: I) -> Selfwhere I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Parse from iterator, exit on error
source§

fn try_parse_from<I, T>(itr: I) -> Result<Self, Error>where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Parse from iterator, return Err on error.
source§

fn update_from<I, T>(&mut self, itr: I)where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Update from iterator, exit on error
source§

fn try_update_from<I, T>(&mut self, itr: I) -> Result<(), Error>where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Update from iterator, return Err on error.
source§

impl Subcommand for Command

source§

fn augment_subcommands<'b>(__clap_app: Command<'b>) -> Command<'b>

Append to Command so it can instantiate Self. Read more
source§

fn augment_subcommands_for_update<'b>(__clap_app: Command<'b>) -> Command<'b>

Append to Command so it can update self. Read more
source§

fn has_subcommand(__clap_name: &str) -> bool

Test whether Self can parse a specific subcommand

Auto Trait Implementations§

Blanket Implementations§

§

impl<T> AbiExample for T

§

default fn example() -> T

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32 ) -> TaggedParser<'a, Implicit, Self, E>

source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more