cli/ directory of the DefDrive repository. This guide covers how to run and build the CLI.
Prerequisites
Before running the CLI, ensure you have:Go Installed
Running the CLI
Option 1: Run Directly with Go
The simplest way to run the CLI is usinggo run:
Option 2: Build a Binary
For repeated use or distribution, build a standalone binary:Option 3: Install Globally
Install the CLI to your$GOPATH/bin for system-wide access:
For a better command name, consider renaming the package or using
go build with the -o flag to create a binary named defdrive.Verifying Installation
After running the CLI with any method above, you should see the interactive prompt:Dependencies
The CLI relies on the following Go packages:View Dependencies
View Dependencies
- github.com/charmbracelet/bubbletea - TUI framework for building the interactive interface
- encoding/json - JSON encoding/decoding for API requests and config storage
- net/http - HTTP client for API communication
- io/ioutil - File I/O operations for credential storage
- os - Operating system interface
- strings - String manipulation utilities
- fmt - Formatted I/O
go.mod and go.sum files track exact versions.Troubleshooting
Error: go: cannot find main module
Error: go: cannot find main module
Ensure you’re running the command from the correct directory. The CLI should be run from either:
- The repository root:
go run cli/main.go - The cli directory:
cd cli && go run main.go
Error: cannot download dependencies
Error: cannot download dependencies
If you’re behind a proxy or firewall, configure Go’s proxy settings:Or disable module verification temporarily:
Binary won't execute on macOS
Binary won't execute on macOS
If macOS blocks the binary due to security settings:
Next Steps
Configuration
Learn how the CLI stores and manages credentials
Authentication
Understand the signup and login flows