Skip to content

tmickleydoyle/moonwalk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

63 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

MoonWalk: Walk to the root directory ๐ŸŒ™

moonwalk recursively walks the working directory back to the root returning all files in the walk back. It now includes filtering, search, multiple output formats, an interactive TUI mode, and detailed statistics about files found in the walk.

MoonWalk Demo Go Version

โœจ Features

  • ๐Ÿš€ Walk from current directory or a specified path back to root
  • ๐Ÿ” Filter files by extension
  • ๐Ÿ“ Search for text within files
  • ๐Ÿ“Š Multiple output formats (text, JSON, CSV)
  • ๐Ÿ–ฅ๏ธ Interactive TUI mode with real-time navigation
  • ๐Ÿ“ File size reporting
  • ๐Ÿ“ˆ Statistics and summary information
  • ๐ŸŽฏ Control depth of directory traversal

Examples

๐ŸŽฎ Interactive TUI Mode

Launch the beautiful terminal user interface:

$ moonwalk -tui

TUI Features:

  • ๐Ÿ“ Visual file browser with file-type specific icons (๐Ÿน Go, ๐Ÿ Python, ๐ŸŸจ JavaScript, etc.)
  • โŒจ๏ธ Keyboard navigation with arrow keys or vim-style (j/k)
  • ๐Ÿ” Live search - press / to filter files by name
  • ๐Ÿ“Š Toggle statistics - press d to show/hide detailed info
  • ๐Ÿ“ Path display - press p to toggle current directory path
  • โ“ Interactive help - press h or ? for command reference
  • ๐Ÿ”„ Real-time refresh - press r to rescan directory
  • ๐ŸŽจ Beautiful styling with syntax highlighting
  • ๐Ÿ“ฑ Responsive design that adapts to terminal size

TUI Keyboard Shortcuts:

Key Action
โ†‘/โ†“ or j/k Navigate up/down
g / G Go to top/bottom
/ Enter search mode
d Toggle detailed statistics
p Toggle path display
h or ? Toggle help
r Refresh/rescan files
q or Ctrl+C Quit

Combine TUI with other options:

# TUI mode with Go files only
$ moonwalk -tui -ext .go

# TUI mode with content search
$ moonwalk -tui -search "TODO"

# TUI mode from specific directory
$ moonwalk -tui -path /home/user/projects

๐Ÿ“š CLI Examples

Basic usage from the current directory

$ moonwalk

Moonwalk from a specific directory

$ moonwalk -path /Users/tmickleydoyle/Desktop

The path needs to be the absolute path to the working directory.

Filter by file extension

$ moonwalk -ext .go

Search for text within files

$ moonwalk -search "import"

Limit directory depth

$ moonwalk -depth 2

Show file sizes

$ moonwalk -size

Generate summary statistics

$ moonwalk -summary

Output in different formats

$ moonwalk -format json
$ moonwalk -format csv

๐ŸŽฏ Advanced combinations

# Search for Go functions with file sizes in JSON format
$ moonwalk -path /Users/tmickleydoyle/Projects -ext .go -search "func" -size -format json

# Get summary of Python files up to 3 levels deep
$ moonwalk -ext .py -depth 3 -summary

# Interactive TUI for JavaScript files with content search
$ moonwalk -tui -ext .js -search "import"

๐Ÿ“‹ Example Output (Text Format)

[Directory] "/Users/tmickleydoyle/Desktop"
[File] "/Users/tmickleydoyle/Desktop/data.csv" (2.3 KB)
[File] "/Users/tmickleydoyle/Desktop/data.json" (4.1 KB)
[File] "/Users/tmickleydoyle/Desktop/filename.txt" (512 B)
[File] "/Users/tmickleydoyle/Desktop/download.png" (2.5 MB)
[Directory] "/Users/tmickleydoyle"
[File] "/Users/tmickleydoyle/cohorts.json" (1.2 KB)
[File] "/Users/tmickleydoyle/house_query.sql" (3.4 KB)
[Directory] "/Users"
[File] "/Users/setup.txt" (128 B)

๐Ÿ“Š Example Output (Summary)

Summary:
Total Files: 8
Total Directories: 3
Total Size: 2.5 MB
Average File Size: 320.0 KB
Largest File: /Users/tmickleydoyle/Desktop/download.png (2.5 MB)

File Extensions:
.csv: 1 files
.json: 2 files
.txt: 2 files
.png: 1 files
.sql: 1 files
.html: 1 files

๐Ÿš€ Installation

Using Go Install

go install github.com/tmickleydoyle/moonwalk@latest

From Source

git clone https://github.com/tmickleydoyle/moonwalk.git
cd moonwalk
go build -o moonwalk .

Dependencies

  • Go 1.15 or higher
  • Terminal with color support (for best TUI experience)

๐Ÿ“– Usage

Usage:
  moonwalk [flags]

Flags:
  -path string       starting point directory
  -ext string        filter files by extension (e.g., .go, .txt)
  -search string     search for text within files
  -format string     output format (text, json, csv) (default "text")
  -size              show file sizes
  -summary           show summary statistics
  -depth int         maximum directory depth (-1 for unlimited) (default -1)
  -tui               run in interactive TUI mode

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

๐Ÿ™ Acknowledgments

  • Built with Bubble Tea for the TUI interface
  • Styled with Lip Gloss for beautiful terminal output
  • Inspired by the need for better directory exploration tools

About

Walk the working directory towards the root recursively

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published