Skip to content

skinit/gomount

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

GoMount πŸš€

GoMount Demo

A modern, configurable terminal application for managing SSH filesystem mounts. Built with Go, featuring both interactive TUI and CLI interfaces using Cobra, Bubble Tea, and Lip Gloss.

GoMount provides a flexible configuration system through JSON files, allowing you to define custom mount targets and easily manage remote filesystem connections with a beautiful, colorful interface.

✨ Features

  • 🎨 Vibrant TUI - Beautiful, colorful terminal user interface with Bubble Tea
  • ⌨️ CLI Commands - Traditional command-line interface for scripting and automation
  • πŸ“ Mount Management - Mount/unmount SSH filesystems with ease using SSHFS
  • πŸ“‹ Status Overview - List all mount targets with current status
  • πŸ”§ JSON Configuration - Flexible configuration system via gomount.json
  • 🎯 Interactive Mode - Navigate with keyboard shortcuts and selections
  • πŸ’Ύ Configurable Mountpoints - Define custom mount directories
  • πŸ”’ SSH Key Support - Seamless authentication with SSH keys
  • πŸ“Š Multiple Targets - Manage multiple remote servers simultaneously
  • 🎨 Custom Styling - Vibrant color scheme with Lip Gloss styling

πŸ› οΈ Requirements

macOS System Requirements

  • macOS 10.15 or later
  • Go 1.19 or later (for building from source)
  • SSHFS - SSH Filesystem client
  • SSH access to remote servers

Installing Dependencies

# Install SSHFS via Homebrew
brew install sshfs

# Verify installation
sshfs --version

SSH Key Setup (Recommended)

For seamless mounting without password prompts, set up SSH keys:

# Generate SSH key (if you don't have one)
ssh-keygen -t ed25519 -C "your_email@example.com"

# Copy public key to remote servers
ssh-copy-id username@hostname

πŸ“¦ Installation

Option 1: Build from Source

# Clone the repository
git clone https://github.com/stephan/gomount.git
cd gomount

# Build the application  
./build.sh

# Optionally install to system PATH
sudo cp gomount /usr/local/bin/

Option 2: Direct Go Install

# Install directly with go (if repository is public)
go install github.com/stephan/gomount@latest

Option 3: Manual Build

# Build manually with go
go mod tidy
go build -o gomount .

πŸš€ Usage

First Time Setup

Important: Before using GoMount, you must configure your remote drives in the gomount.json file.

  1. Create or edit gomount.json in your project directory (same location as the gomount executable)
  2. Define your remote servers with connection details
  3. Set your preferred mountpoint directory

See the Configuration File section below for detailed examples.

Interactive Mode (Default)

Simply run gomount to enter the beautiful TUI:

gomount

Navigate using:

  • ↑/↓ or k/j - Move cursor up/down
  • Enter - Select option
  • Esc - Go back to previous menu
  • q or Ctrl+C - Quit application

CLI Commands

List all mount targets and their status

gomount list

Mount a specific target

gomount mount server1
gomount mount demo-server-1
gomount mount production-server

Unmount a specific target

gomount unmount server1

Unmount all mounted directories

gomount unmount all

Configuration File

GoMount requires a gomount.json configuration file to define your remote mount targets.

Configuration File Location

The configuration file should be located in:

  1. Same directory as the gomount executable (default)
  2. Custom location specified with --config flag
  3. Current working directory when running gomount

Configuration Structure

The gomount.json file includes:

  • mountpoint: Base directory where all targets will be mounted
  • viewer: Optional file viewer command (e.g., "open", "nautilus")
  • targets: Array of your remote server configurations

Basic Configuration Example

{
  "mountpoint": "/tmp/gomount",
  "viewer": "open",
  "targets": [
    {
      "name": "my-server",
      "host": "192.168.1.100",
      "user": "username", 
      "path": "/home/username",
      "port": 22
    },
    {
      "name": "web-server",
      "host": "webserver.example.com",
      "user": "webmaster",
      "path": "/var/www/html",
      "port": 22
    }
  ]
}

Advanced Configuration Examples

Home Directory Mount:

{
  "mountpoint": "$HOME/RemoteServers",
  "targets": [
    {
      "name": "home-nas",
      "host": "nas.local",
      "user": "admin",
      "path": "/volume1/homes/admin",
      "port": 22
    }
  ]
}

Multiple Server Types:

{
  "mountpoint": "/mnt/remote",
  "targets": [
    {
      "name": "development",
      "host": "dev.company.com",
      "user": "developer",
      "path": "/var/www/dev",
      "port": 2222
    },
    {
      "name": "production", 
      "host": "prod.company.com",
      "user": "deploy",
      "path": "/var/www/html",
      "port": 22
    },
    {
      "name": "backup-server",
      "host": "backup.company.com", 
      "user": "backup",
      "path": "/backups",
      "port": 22
    }
  ]
}

Mount Locations

Each target is mounted to: {mountpoint}/{name}

Examples:

  • Target "my-server" β†’ /tmp/gomount/my-server
  • Target "web-server" β†’ /tmp/gomount/web-server
  • With $HOME/RemoteServers β†’ /Users/yourname/RemoteServers/home-nas

πŸ”§ Configuration Options

Command Line Flags

GoMount supports several command-line options:

  • -c, --config: Path to config file (default: gomount.json)
  • -m, --mountpoint: Override mountpoint directory from config
  • -v, --viewer: Override viewer command from config

Examples:

# Use custom config file location
gomount --config /path/to/my-servers.json

# Override mountpoint from config file  
gomount --mountpoint /custom/mount/location

# Override viewer command
gomount --viewer "code"

# Combine multiple options
gomount --config ~/my-config.json --mountpoint ~/MyMounts

Target Configuration Fields

Each target in gomount.json supports these fields:

  • name: Unique identifier for the mount target
  • host: Remote server hostname or IP address
  • user: SSH username for authentication
  • path: Remote directory path to mount
  • port: SSH port (typically 22)

Environment Variables

You can use $HOME in the mountpoint path, which will be automatically expanded:

{
  "mountpoint": "$HOME/Mountpoints"
}

🎨 Color Scheme

GoMount uses a vibrant color palette:

  • Primary: Coral Red (#FF6B6B)
  • Secondary: Turquoise (#4ECDC4)
  • Accent: Golden Yellow (#FFE66D)
  • Success: Mint Green (#95E1D3)
  • Warning: Orange (#FFA726)
  • Error: Red (#FF5252)

πŸ—οΈ Building

Standard Build

./build.sh

Skip Tests

./build.sh --skip-tests

Version Build

./build.sh v1.0.0

The build script creates:

  • Architecture-specific binaries
  • Universal macOS binary
  • Optional system installation

πŸ§ͺ Development

Project Structure

gomount/
β”œβ”€β”€ main.go                 # Application entry point
β”œβ”€β”€ cmd/                    # Cobra CLI commands
β”‚   β”œβ”€β”€ root.go
β”‚   β”œβ”€β”€ mount.go
β”‚   β”œβ”€β”€ unmount.go
β”‚   └── list.go
β”œβ”€β”€ internal/
β”‚   β”œβ”€β”€ config/            # Mount configurations
β”‚   β”œβ”€β”€ mount/             # Mount operations
β”‚   └── tui/               # Bubble Tea TUI
β”‚       β”œβ”€β”€ models.go
β”‚       β”œβ”€β”€ view.go
β”‚       β”œβ”€β”€ styles.go
β”‚       └── tui.go
β”œβ”€β”€ build.sh               # Build script
└── README.md

Dependencies

  • Cobra - CLI framework
  • Bubble Tea - TUI framework
  • Lip Gloss - Terminal styling

Testing

go test ./...

πŸ› Troubleshooting

Common Issues

"sshfs: command not found"

brew install sshfs

"Permission denied" when mounting

  • Ensure SSH key authentication is set up
  • Test manual SSH connection: ssh username@hostname

"Directory not empty" when unmounting

  • Force unmount: diskutil unmount force ~/Mountpoints/target
  • Or restart the application

Mount appears empty

  • Check SSH connection
  • Verify remote path exists
  • Ensure proper permissions

Debug Mode

Enable verbose output by setting:

export DEBUG=1
gomount

πŸ“„ License

[Add your license here]

🀝 Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ™ Acknowledgments

  • Original sshfsmount.sh script functionality
  • Charm for Bubble Tea and Lip Gloss
  • Cobra CLI library
  • The Go community

Made with ❀️ and lots of β˜•

About

SSH Filesystem Manager providing a flexible configuration system through JSON files, allowing you to define custom mount targets and easily manage remote filesystem connections with a beautiful, colorful interface.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors