TechTeaStudio.Console.FileSelector
0.2.1
dotnet add package TechTeaStudio.Console.FileSelector --version 0.2.1
NuGet\Install-Package TechTeaStudio.Console.FileSelector -Version 0.2.1
<PackageReference Include="TechTeaStudio.Console.FileSelector" Version="0.2.1" />
<PackageVersion Include="TechTeaStudio.Console.FileSelector" Version="0.2.1" />
<PackageReference Include="TechTeaStudio.Console.FileSelector" />
paket add TechTeaStudio.Console.FileSelector --version 0.2.1
#r "nuget: TechTeaStudio.Console.FileSelector, 0.2.1"
#:package TechTeaStudio.Console.FileSelector@0.2.1
#addin nuget:?package=TechTeaStudio.Console.FileSelector&version=0.2.1
#tool nuget:?package=TechTeaStudio.Console.FileSelector&version=0.2.1
TechTeaStudio.Console.FileSelector
An interactive console file browser for .NET. Navigate directories and pick a file with a tiny cd / select command loop — useful whenever a console app needs the user to point at a file without dragging in a TUI framework.
Targets net6.0, net8.0, net9.0, net10.0.
Install
dotnet add package TechTeaStudio.Console.FileSelector
Quick start
using TechTeaStudio.Console.FileSelector;
IConsoleFileBrowser browser = new ConsoleFileBrowser();
string? path = browser.SelectFile(
initialDirectory: Environment.GetFolderPath(Environment.SpecialFolder.Desktop),
fileExtensions: ".png,.jpg",
welcomeMessage: "Pick an image");
if (path is null)
Console.WriteLine("Cancelled.");
else
Console.WriteLine($"Selected: {path}");
What you get
- Directory listing with
[D]/[F]markers. - Extension filter (e.g.
".png,.jpg,.jpeg", or"*"for everything). - Up/Down command history.
- Absolute and relative paths supported for
cdandselect.
Commands
| Command | What it does |
|---|---|
cd <folder> |
Enter a subdirectory (relative or absolute). |
cd .. or cd |
Go up one level. |
cd / or cd \ |
Jump to the root of the current drive. |
select <file> |
Pick a file and return its absolute path to the caller. |
help / ? |
Show the command list. |
exit / quit / q |
Cancel — SelectFile returns null. |
API
public interface IConsoleFileBrowser
{
string? SelectFile(
string initialDirectory,
string? fileExtensions = "*",
string? welcomeMessage = "Welcome To ConsoleFileBrowser");
}
Returns the absolute path of the chosen file, or null if the user cancelled.
The ConsoleImage sample
The repo also contains a small utility that uses the browser to pick an image and then renders it as ANSI-truecolor ASCII art in the terminal. Build it from source/ConsoleImage and run it on a terminal that supports virtual terminal sequences (Windows Terminal, Windows 10+ conhost with VT enabled, any modern Linux/macOS terminal).
Build & test
dotnet build ConsoleImage.slnx
dotnet test ConsoleImage.slnx
Release
Bump <Version> in source/ConsoleFileBrowser/ConsoleFileBrowser.csproj, commit, push to product. CI builds, packs, and publishes to nuget.org automatically.
License
MIT — see LICENSE.txt.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- No dependencies.
-
net6.0
- No dependencies.
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
v0.2.0 — Major refactor.
Added:
* Multi-target: net6.0, net8.0, net9.0, net10.0.
* `help` / `?` command in the interactive loop.
* Absolute-path support for `cd` and `select`.
Changed (breaking):
* Type renamed: ConsoleFileSelector.Framework.ConsoleFileSelector -> TechTeaStudio.Console.FileSelector.ConsoleFileBrowser.
* Interface renamed: IFileSelector -> IConsoleFileBrowser.
* Namespace: ConsoleFileSelector.Framework -> TechTeaStudio.Console.FileSelector.
* SelectFile parameter `firstMessage` renamed to `welcomeMessage`.
* `fileExtensions` parameter is now optional (defaults to `*`).
Fixed:
* Welcome message now renders on every redraw instead of from the second iteration on.
* History/state no longer leaks between successive SelectFile calls on the same instance.
* Backspace no longer crashes when the input buffer is empty.
* Up/Down history navigation handles bounds correctly and does not push duplicate entries.
Full changelog: https://github.com/TechTeaStudio/ConsoleImage/blob/product/CHANGELOG.md