goFTree is a command-line tool that displays the structure of a given directory, generating a tree-like view of files and subdirectories. The output can be customized in various formats such as ASCII, Markdown, XML, and more.
- Filesystem Traversal: Walk through directories and list their contents recursively.
- Multiple Output Styles: Render the directory structure in ASCII, Markdown, XML, JSON, or other custom formats.
- File Output: Save the generated output to a file or print it directly to the console.
- Interactive Confirmation: Prevent overwriting files unless confirmed by the user.
goFTree [path] [flags]-
--style,-s(default:ascii): The style in which the tree will be rendered. Options are:ascii: Plain text with indentation.markdown: Markdown format.xml: XML format.json: JSON format.line: Line-based structure.dashed: Line-based structure with dashed borders.nerd: Uses Nerd Font icons to enhance the tree visualization with symbols.
-
--file,-f: The file to which the output will be written. If the file exists, you will be asked for confirmation before overwriting it. -
--include-hidden,-i: Wether to include hidden files and or directories. Options are:- all: include all hidden entries
- files: only includes hidden files
- dirs: only includes hidden directories
- none: do not include hidden entries
-
--version,-v: Prints the installed version
Before installing GoFTree, verify that the file matches the provided SHA256 checksum to ensure its integrity.
- Find the checksum on the release page.
- Use the following commands to check the file:
- Compare the result with the release page checksum. If they match, proceed with the installation.
Windows:
certutil -hashfile <path_to_installer> SHA256Linux/Mac:
sha256sum <path_to_installer>- Download the
goftree.exebinary from the releases page. - Move the selected binary to a directory included in your
PATH(e.g.,C:\Program Files\goftree\). - Optionally, set a persistent PowerShell alias (see below).
To create an alias so goftree can be used from anywhere:
1. Open PowerShell and run:
notepad.exe $PROFILE2. Add the following line:
Set-Alias -Name goftree -Value "C:\Program Files\goftree\goftree.exe"3. Save and close Notepad.
4. Restart PowerShell or run . $PROFILE to apply changes.
You can easily install GoFTree using the Chocolatey package manager. Follow these steps:
If you don't have Chocolatey installed, follow the installation instructions on their official website: Chocolatey Installation Guide.
Once Chocolatey is installed, you can install GoFTree by running the following command in an elevated PowerShell or Command Prompt window:
choco install goftreeAfter installation, verify that GoFTree was successfully installed by running the following command:
goftree --version1. Download the appropriate goftree binary for your OS and architecture from the releases page
2. Move it to /usr/local/bin and give it execute permissions:
sudo mv goftree /usr/local/bin/
sudo chmod +x /usr/local/bin/goftree3. (Optional) Set an alias by adding this line to ~/.bashrc, ~/.bash_profile, or ~/.zshrc (for Zsh users):
alias goftree="/usr/local/bin/goftree"4. Apply changes by running:
source ~/.bashrcTo use the nerd style in goFTree, you'll need to have a Nerd Font installed. Visit the Nerd Fonts GitHub page to download a font and install it according to your operating system's method.
Once installed, set your terminal to use the Nerd Font, and the nerd style in goFTree will display enhanced icons.
To build the GoFTree binaries using the provided Dockerfile, follow the steps below:
First, build the Docker image from the Dockerfile:
docker build -t goftreebuilder .This will create a Docker image named goftreebuilder, which contains the necessary environment to build the GoFTree binaries.
Once the image is built, you can run the Docker container to build the binaries. Use the following command:
docker run --rm -e VERSION=<versionstring> -v "<yourLocalOutputDir>:/output" goftreebuilder<versionstring>:- This placeholder represents the version of your build and can be replaced with any UTF-8 string (e.g.,
v1.0.0,latest,2025-02-22, etc.). - Example:
-e VERSION=v1.0.0
- This placeholder represents the version of your build and can be replaced with any UTF-8 string (e.g.,
<yourLocalOutputDir>:- This placeholder represents a path on your local machine where the build binaries will be saved.
- The
-vflag mounts this directory onto the/outputdirectory inside the container, so after the build process completes, you can access the compiled binaries in your local output directory. - Note: Make sure the directory you specify exists on your local machine.
- Example:
-v "/path/to/output:/output"
Run the buildchoco.ps1 script from the root of the project to create a Chocolatey package.
Execute the following command in PowerShell from the root of the project:
.\buildchoco.ps1 "<path_to_32bit_exe>" "<path_to_64bit_exe>" "<version>"<path_to_32bit_exe>: Path to the 32-bit GoFTree executable.<path_to_64bit_exe>: Path to the 64-bit GoFTree executable.<version>: The version for the package (e.g.,1.0.0).
- The script will create ZIP files for both executables in
choco/goFTree/tools/. - It will update the
goftree.nuspecversion and runchoco pack. - The output
.nupkgfile will be placed inchoco/out/.