https://github.com/magdyamr542/mvp
Mv but with patterns
https://github.com/magdyamr542/mvp
Last synced: 4 months ago
JSON representation
Mv but with patterns
- Host: GitHub
- URL: https://github.com/magdyamr542/mvp
- Owner: magdyamr542
- Created: 2023-08-22T10:18:51.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2023-08-22T10:28:49.000Z (about 2 years ago)
- Last Synced: 2025-05-29T23:43:56.009Z (5 months ago)
- Language: Go
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## MVP is mv with patterns
Usacases:
```bash
$ ls
log_1.json log_2.json warn_3.json error_3.json README.md$ mvp \$1_\$2.json \$2_\$1.json
$ ls
1_log.json 2_log.json 3_warn.json 3_error.json README.md````
Use `$` like `$1` `$2` etc to match patterns and use these matched patterns in the new file names.
If you have files like `log_2023-08-22_dev.json warn_2023-08-22_prod.json warn_2023-08-23_stage.json`. They clearly
have this pattern `__.json`. Use `mvp` to match these.
The pattern `\$1_\$2_\$3.json` will replace `$1` with the **log level**, `$2` with the **date** and `$3` with the
**environment**. We might be interested in a new naming. Something like `__.json`Before:
```bash
## Before mvp
$ ls
log_2023-08-22_dev.json warn_2023-08-22_prod.json warn_2023-08-23_stage.json$ mvp \$1_\$2_\$3.json \$3_\$1_\$2.json
## After mvp
$ ls
dev_log_2023-08-22.json prod_warn_2023-08-22.json stage_warn_2023-08-23.json
```