Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xixixao/map
map command for unix shells
https://github.com/xixixao/map
Last synced: 19 days ago
JSON representation
map command for unix shells
- Host: GitHub
- URL: https://github.com/xixixao/map
- Owner: xixixao
- Created: 2013-02-17T15:26:52.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2013-02-28T00:03:56.000Z (almost 12 years ago)
- Last Synced: 2024-11-14T20:47:47.839Z (3 months ago)
- Language: CoffeeScript
- Homepage:
- Size: 125 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
map
===**map** command for unix environments.
- Non-unix way to do unix.
- Simplified bash loop.
- Pretty output.
- Fail-fast.## Installation
You will need `Node.js` version at least 0.6.x
Copy the file `map` to your preferred `bin` folder.
## Examples
```bash
$ map one two three "touch document_#it.md"
``````bash
$ map folder/ "convert #it #path.png"
```Note the `/` at the end of folder name is important.
```bash
$ map folder/ "mv #it #dir/good_#name_backup#ext"
``````bash
$ map profiles/ "map profiles/ 'diff #it ##it'"
``````bash
$ map a b c "echo #ext"
#ext token used but a was not found.
```## Documentation
### Replacement Tokens
Complete:
- `#it` the fully qualified file name: directory location, name and extension
Separate parts:
- `#dir` the containing directory, without a slash at the end
- `#name` only the name of the file, without directory location and extension
- `#ext` the file extension, starting at the last dot in the file nameJoined parts:
- `#path` the path of the file, including its name but without extension
- `#file` the file name, name and extension without directory locationTherefore, `#it` == `#dir/#name#ext` == `#path#ext` == `#dir/#file`
### Silencing
To hide the pretty output from **map**, use the MAPSILENT environment variable.
If set to `true`, map won't print any of its own output, otherwise it displays
the command it is about to execute.```bash
$ export MAPSILENT=true
```### Background Processes
If the the supplied command ends in `&` (for a background job), **map** won't wait
for it to finish and will continue executing rest of the commands (asynchronous vs.
synchronous execution).### Escaping
To use the tokens literally, for any reason, add another hash in front of them.
```bash
$ map adam tom jerry "_('##name').find('#it');" 2> /dev/null_('#name').find('adam');
_('#name').find('tom');
_('#name').find('jerry');
```### Nested map
Thanks to escaping, nesting **map**s is easy and can be done to arbitrary level.
```bash
$ map B C D "map am uck ick \"map land ash up 'echo #it##it###it'\""
```