Anoma.Client.CLI (Anoma v0.29.0)
I implement the logic for the Anoma client commandline interface.
Usage
The executable expects the following arguments:
--listen-port
- The port on which the client will listen for incoming connections.--node-host
- The host of the remote node.--node-port
- The port of the remote node.--node-id
- The id of the remote node.
For example, assuming an Anoma node running on ip 'localhost' and port '4000', start the client with the following command.
./anoma_client --listen-port 4001 --node-host localhost --node-port 4000 --node-id 123456
Running a node
Running a node can be done using the same repository. In an Elixir shell of the Anoma repo, run the following.
iex(1)> Anoma.Node.Examples.ENode.start_node(grpc_port: 8181)
%Anoma.Node.Examples.ENode{
grpc_port: 8181,
tcp_ports: [],
pid: #PID<0.353.0>,
node_id: "110532251"
}
Use the value of grpc_port
to point your client to the node.
The client will connect to the remote node and start listening for incoming connections on port 4001.
Building
To build the binary for the client run the following from the root of this repository.
mix do --app anoma_client escript.build
Summary
Functions
I parse the arguments into a keyword list and validate if all the arguments are present.
Given a list of arguments, I start a new connection to a remote node.
Given a keyword list, I check if all required arguments are present. I return a list of missing arguments if theyre not present.
Functions
main(args)
parse_args(args)
@spec parse_args([String.t()]) :: {:ok, Keyword.t()} | {:error, {:invalid_args, [String.t()]}} | {:error, {:missing_args, [atom()]}}
I parse the arguments into a keyword list and validate if all the arguments are present.
start_node(args)
Given a list of arguments, I start a new connection to a remote node.
Options
:listen_port
- The port on which the client will listen for incoming connections.:node_host
- The host of the remote node.:node_port
- The port of the remote node.
validate_args(args)
Given a keyword list, I check if all required arguments are present. I return a list of missing arguments if theyre not present.