Modern file system navigation tool on Unix

Related tags

Command-line monat
Overview

monat -- Modern file system Navigator

Introduction

monat is a Unix shell auxiliary command focusing on the navigation of the file system, especially for working in big projects. Think of a scenario where you are at the root directory of a big project, and there are files lying in many deep directories. It's common to visit the files, rename or move them, run a command in some sub-directories and come back to the root, etc. It would be tedious to input the long path prefix again and again.

monat is designed to simplify this process by leveraging a simple syntax to express the long path prefix.

⚠️ This project is still in the process of development. Your contributions are welcome.

Example

monat-demo

  • Rename:

     $ mv path/to/the/foo.txt path/to/the/bar.txt

    In monat we can input command below, which is shorter:

     $ mn path/to/the/foo.txt ,/bar.txt
  • Move file up one level:

     $ mv path/to/another/foo.txt path/to/

    In monat we can input:

     $ mn path/to/another/foo.txt ,/../
  • Use history:

    Directory visited by monat just now will be stored in the history. Using the mn command without arguments will list the history. When in Bash, you can also press to autocomplete.

     $ mn ,<TAB>
         >
     1 -- path/to/the
     2 -- path/to/another
     3 -- path/to
        

    Then you can use the number after the comma to represent the path:

     $ mn ,1/bar.txt ,2

    is equivalent to:

     $ mv path/to/the/bar.txt path/to/another/
  • Run another command by leveraging monat:

     $ mn -c vim ,2/bar.txt

    is equivalent to:

     $ vim path/to/another/bar.txt
  • Dive into a sub-directory and run a command:

     $ cd path/to/the/
     $ source update.sh
     $ cd -

    Though you can gather them into one line, you can't have filename autocompletion though:

     $ cd path/to/the/ && source update.sh; cd -

    In monat we can input:

     $ mn -d ,1 -c source update.sh

    The advantages are:

    1. short command in one line,

    2. the update.sh filename can be autocompleted by pressing .

Remember you can always press to complete the path, command and filename in Bash, including the one represented by comma and number, which is very easy to input the whole command. Support for other shells will be added in future.

Usage

Syntax

The monat syntax is simple. The path starting with a comma (,) is called Path Epitome.

If inputing two path with the second one starting with a comma, the comma represents the path prefix of the first one. Just like the first example.

If a comma follows a number i, it means the ith history record in the history file.

Arguments

monat's function varies by the number of Path Epitome arguments.

  1. 0 Path Epitome: list the history for the current directory

  2. 1 Path Epitome: monat serves as the ls command

  3. 2 Path Epitomes: monat serves as the mv command

  4. with -c argument: run the command passed by -c and expand the Path Epitome.

History file

monat stores a history for each project in the .monat/history file in the root of the project. Before all the operations, first use mn -l in the root directory to set the current directory as the root of the project. If no local monat history is found, then monat will use the history in home directory ~/.monat/history.

The number of history records will be limited to 10 and in a First-In-First-Out (FIFO) manner.

Tradeoffs

monat can only be used when there are no filenames starting with a comma. In the real world this kind of filename will be rare so we consider the design workable.

Contribution

monat needs more features to be a better tool. Future works:

  1. support the same arguments of ls and mv

  2. For now the monat only supports autocompletion for Bash. We need support for other shells (especially zsh).

You might also like...
A tool for BFS (Bugbear File System) archives

bfstool bfstool is a tool for BFS (Bugbear File System) archive creation, extraction and more. BFS archives are present in most games developed by Bug

A CLI tool for CIs and build scripts, making file system based caching easy and correct (locking, eviction, etc.)

FS Dir Cache A CLI tool for CIs and build scripts, making file system based caching easy and correct (locking, eviction, etc.) When working on build s

A simple, modern fuzzy finder tool to run examples in a Cargo project.

cargo-rx cargo-rx is a simple, modern Runner for Examples in a Cargo project. This crate provides a single executable: rx. Basically anywhere you woul

A Modern And Secure CLI Tool For Managing Environment Variables
A Modern And Secure CLI Tool For Managing Environment Variables

Envio is a command-line tool that simplifies the management of environment variables across multiple profiles. It allows users to easily switch between different configurations and apply them to their current environment

A Rust curses library, supports Unix platforms and Windows

pancurses pancurses is a curses library for Rust that supports both Linux and Windows by abstracting away the backend that it uses (ncurses-rs and pdc

Reviving the Research Edition Unix speak command

This repository contains the source code of Unix speak program that appeared in the Third (1973) to Sixth (1975) Research Unix editions, slightly adjusted to run on a modern computer. Details on the code's provenance and the methods employed for reviving it can be found in this blog post.

Spawn multiple concurrent unix terminals in Discord

Using this bot can be exceedingly dangerous since you're basically granting people direct access to your shell.

fcp is a significantly faster alternative to the classic Unix cp(1) command
fcp is a significantly faster alternative to the classic Unix cp(1) command

A significantly faster alternative to the classic Unix cp(1) command, copying large files and directories in a fraction of the time.

A small unix and windows lib to search for executables in PATH folders.

A small unix and windows lib to search for executables in path folders.

Owner
Pavinberg
Pavinberg
"Better" tab and stack navigation for Sway WM.

sway_bfocus "Better" tab and stack navigation for Sway WM. Proof of concept. This program lets you create one set of keybinds exclusively for cycling

null 42 Oct 23, 2022
Galileo OSNMA (Open Service Navigation Message Authentication)

galileo-osnma galileo-osnma is a Rust implementation of the Galileo OSNMA (Open Service Navigation Message Authentication) protocol. This protocol is

Daniel Estévez 26 Nov 25, 2022
Rust File Management CLI is a command-line tool written in Rust that provides essential file management functionalities. Whether you're working with files or directories, this tool simplifies common file operations with ease.

Rust FileOps Rust File Management CLI is a command-line tool written in Rust that provides essential file management functionalities. Whether you're w

Harikesh Ranjan Sinha 5 May 2, 2024
A command line tool written in Rust and designed to be a modern build tool + package manager for C/C++ projects.

CCake CCake is a command line tool written in Rust and designed to be a modern build tool + package manager for C/C++ projects. Goals To be easily und

Boston Vanseghi 4 Oct 24, 2022
A modern high-performance open source file analysis library for automating localization tasks

?? Filecount Filecount is a modern high-performance open source file analysis library for automating localization tasks. It enables you to add file an

Babblebase 4 Nov 11, 2022
A tool for automating terminal applications in Unix.

expectrl A tool for automating terminal applications in Unix. Using the library you can: Spawn process Control process Expect/Verify responces It was

Maxim Zhiburt 132 Dec 14, 2022
A lightweight terminal tool to manage processes in Unix machines.

TTV v0.0.1 TTV (term-task-viewer) is a lightweight tool to view and manage active processes in Unix machines. It provides an easy interface with vim-l

Caio Ishikawa 9 Aug 29, 2023
Pink is a command-line tool inspired by the Unix man command.

Pink is a command-line tool inspired by the Unix man command. It displays custom-formatted text pages in the terminal using a subset of HTML-like tags.

null 3 Nov 2, 2023
A command-line tool aiming to upload the local image used in your markdown file to the GitHub repo and replace the local file path with the returned URL.

Pup A command line tool aiming to upload the local image used in your markdown file to the GitHub repo and replace the local file path with the return

SteveLau 11 Aug 17, 2022
A tool for determining file types, an alternative to file

file-rs a tool for determining file types, an alternative to file whats done determining file extension determining file type determining file's mime

null 3 Nov 27, 2022