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
24
Examples.md
24
Examples.md
@@ -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
|
||||
|
||||

|
||||
|
||||
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"
|
||||
}
|
||||
Reference in New Issue
Block a user