m/fzf
1
0
mirror of https://github.com/junegunn/fzf.git synced 2025-11-18 08:13:40 -05:00

Adding a couple shortcuts for working with Docker

Michael Christensen
2019-01-17 00:03:09 -08:00
parent c5bcdb20e0
commit 0ab7cb0628

@@ -45,6 +45,7 @@ Table of Contents
* [fzf-marker](#fzf-marker)
* [Search for academic pdfs by author, title, keywords, abstract](#search-for-academic-pdfs-by-author-title-journal-institution)
* [BibTeX](#bibtex)
* [Docker](#docker)
@@ -1158,4 +1159,25 @@ Search records in BibTeX files using FZF, select records to cite, or pretty prin
![](https://d.pr/i/8uXzLx+ "screenshot")
This plugin is at https://github.com/msprev/fzf-bibtex
This plugin is at https://github.com/msprev/fzf-bibtex
### Docker
```sh
# Select a docker container to start and attach to
function da() {
local cid
cid=$(docker ps -a | sed 1d | fzf -1 -q "$1" | awk '{print $1}')
[ -n "$cid" ] && docker start "$cid" && docker attach "$cid"
}
```
```sh
# Select a running docker container to stop
function ds() {
local cid
cid=$(docker ps | sed 1d | fzf -q "$1" | awk '{print $1}')
[ -n "$cid" ] && docker stop "$cid"
}