Files
tools/README.md
2024-08-15 22:41:30 +02:00

117 lines
3.3 KiB
Markdown

# My personal tools
## cln
**Create symbolic links given a custom set of commands**
Mainly created out of frustration of windows ""symbolic"" links
This tool creates real symbolic links on any platform following the syntax of:
`source,destination,force?`
It respects existing files (be them real files or symbolic links)
Unless force is set to *t* in which case only existing symbolic links are deleted (overwriten)
Real files will never be deleted by this tool
The commands can be given by:
- stdin
- a file
- command line arguments
- a directory
Example:
- stdin
- `echo "this,that" | cln`
- command line arguments
- `sync this,that foo,bar "path containing spaces",baz`
- files
- `cln -f <file>`
- directory
- `cln -r <directory>`
- This mode looks for "sync" files recursively within the given directory and executes commands in those sync files
Given its ability to read files for commands it can be used to manage a "standard" set of symbolic links
## fiter
**Iterate over files and rename them incrementally**
Example:
Given
```
video1.mp4
video2.mp4
video3.mp4
image1.png
image2.png
executable.exe
```
Running `fiter *` would result in:
```
00001.mp4
00002.mp4
00003.mp4
00005.png
00006.png
00007.exe
```
The order is **not guranteed**
Running `fiter *.mp4` on the same folder would give:
```
00001.mp4
00002.mp4
00003.mp4
image1.png
image2.png
executable.exe
```
The tool will not delete any files by overwriting existing ones
And thanks to that it will fail when running on files that have already been renamed by it
For such scenarios use `fiter -f <glob>`
*-f* renames all files to \<file\>.bak before renaming them back to their new iterative name
This means that it can run on files that already have iterative names because none are being overwriten
**It also means that, on failure, files are left as .bak**
## fmoditer
**Iterate over files and rename them to their mod time**
Works pretty much the same way as *iter* with the exception of *-f* which is not supported by *fmoditer*
## vsclean
**"clean" vscode recent projects by deleting non existing entries and adding new folders**
Reads given directories and adds all folders in directories to vscode's recent projects
The idea is that all projects in a "projects" folder should be accessible to vscode
Doing this manually requires opening every folder one by one
It also removes non existent entries from recent projects and recent files
## repo
**Creates repositories on gitea and assigns them as "origin" on the git repository in working directory**
The configuration of this tool is done through environmental variables:
```
GITEA_USER=dave
GITEA_PASSWORD=supersecret
GITA_URL=https://git.site.quack-lab.dev/
```
Fine grained configuration is applied through flags:
```
Usage of repo.exe:
-f Force assignment of the remote (deletes existing origin)
-n string
Name of the repository (shorthand)
-name string
Name of the repository
-ni
Do not add remote to the new repo (shorthand)
-noinit
Do not add remote to the new repo
-p Make the repository private (shorthand)
-private
Make the repository private
-r string
Name of the remote to create for the new repository (shorthand) (default "origin")
-remote string
Name of the remote to create for the new repository (default "origin")
```