An open API service indexing awesome lists of open source software.

https://github.com/sirkon/portalctl

portalctl and portal make diving into "deep" directories easy!
https://github.com/sirkon/portalctl

qol quality-of-life shell shell-users

Last synced: 2 months ago
JSON representation

portalctl and portal make diving into "deep" directories easy!

Awesome Lists containing this project

README

          

# portalctl

`portalctl` and `portal` make diving into "deep" directories easy!

# Installation

```shell
go install github.com/sirkon/portalctl@latest # Install portalctl.
portalctl setup # Adds portal to your shell and do some other stuff.
```

# What it is and how to use.

Imagine we have a project with deep hierachy of folders. You may do something like
`cd project/internal/libray/internal/sublibrary/…/destination` one time, two times, but it quickly becomes
bothersome once you need to do this again and again and again. Meh.

`portalctl` and `portal` are means to do this pretty easy. The usage scenario with them is:

- Once in a directory you run
```shell
portalctl here
```
Where `` is some identifier.
- When you need to cd in that folder again you just
```shell
portal
```
And your `bash` or `zsh` will move you there.

# More on the `portalctl`.

You can do some management with it:

| command | info |
|-------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `here ` | Adds current directory under the given name - a new portal. |
| `delete ` | Removes both name and path once registered with `here` under the given name. |
| `show ` | Prints a path once registered under the given name. |
| `list` | List all available "portals" with name and its path. |
| `prefix ` | List all names having the given `` |
| `log-compact` | Removes all log entries related to removed portals. |
| `version` | Prints version and exits. |
| `setup` | Registers `` shell function. Registers shell completion for ``. `` is just `portal` by default. Can be customized, see help for the `setup` command. |

# What is under the hood.

`portalctl` works like a database:

- once you do "write" type operations, it adds a new record to a log file placed in `/portalctl/`.
- it reads records in the log file and do a response logic once you do "read" type operation. It is always "full scan",
so that's why `log-compact` is provided. Albeit, the log shouldn't be that huge to really care about this: there are
only a few directories you need to go into regularly in any reasonable scenario.