Selaa lähdekoodia

```更新docker和navi cheat文件

- 在docker.cheat中添加了获取镜像ID和容器ID的示例命令
- 更新了docker-compose.cheat中的部分命令描述
- 在navi.cheat中添加了测试枚举、交互式选择和默认值的示例
```
tianyun 6 kuukautta sitten
vanhempi
commit
134dc0f7e6
2 muutettua tiedostoa jossa 42 lisäystä ja 23 poistoa
  1. 27 23
      container/docker.cheat
  2. 15 0
      navi.cheat

+ 27 - 23
container/docker.cheat

@@ -1,77 +1,81 @@
 % docker
 
-# Remove an image
+# 删除镜像 Remove an image
 docker image rm <image_id>
 
-# Delete an image from the local image store
+# 从本地镜像存储中删除镜像 Delete an image from the local image store
 docker rmi <image_id>
 
-# Clean none/dangling images
+# 清理无标签/悬空的镜像 Clean none/dangling images
 docker rmi $(docker images --filter "dangling=true" -q --no-trunc)
 
-# Force clean none/dangling images
+# 强制清理无标签/悬空的镜像 Force clean none/dangling images
 docker rmi $(docker images --filter "dangling=true" -q --no-trunc) -f
 
-# List all images that are locally stored with the Docker engine
+# 列出本地存储的所有镜像 List all images that are locally stored with the Docker engine
 docker images
 
-# Build an image from the Dockerfile in the current directory and tag the image
+# 从当前目录的 Dockerfile 构建镜像并打标签 Build an image from the Dockerfile in the current directory and tag the image
 docker build -t <image>:<version> .
 
-# Pull an image from a registry
+# 从镜像仓库拉取镜像 Pull an image from a registry
 docker pull <image>:<version>
 
-# Stop a running container through SIGTERM
+# 通过 SIGTERM 停止正在运行的容器 Stop a running container through SIGTERM
 docker stop <container_id>
 
-# Stop a running container through SIGKILL
+# 通过 SIGKILL 强制停止正在运行的容器 Stop a running container through SIGKILL
 docker kill <container_id>
 
-# List the networks
+# 列出所有网络 List the networks
 docker network ls
 
-# List the running containers
+# 列出正在运行的容器 List the running containers
 docker ps
 
-# Delete all running and stopped containers
+# 删除所有正在运行和已停止的容器 Delete all running and stopped containers
 docker rm -f $(docker ps -aq)
 
-# Create a new bash process inside the container and connect it to the terminal
+# 在容器内创建一个新的 bash 进程并连接到终端 Create a new bash process inside the container and connect it to the terminal
 docker exec -it <container_id> bash
 
-# Print the last lines of a container's logs
+# 打印容器日志的最后 100 行 Print the last lines of a container's logs
 docker logs --tail 100 <container_id> | less
 
-# Print the last lines of a container's logs and following its logs
+# 打印容器日志的最后 100 行并持续跟踪日志 Print the last lines of a container's logs and following its logs
 docker logs --tail 100 <container_id> -f
 
-# Create new network
+# 创建新网络 Create new network
 docker network create <network_name>
 
+# 获取镜像 ID (示例命令,需根据实际情况调整) Get image ID (example command, adjust as needed)
 $ image_id: docker images --- --headers 1 --column 3
+
+# 获取容器 ID (示例命令,需根据实际情况调整) Get container ID (example command, adjust as needed)
 $ container_id: docker ps --- --headers 1 --column 1
 
 
 
 % docker-compose
 
-# Builds, (re)creates, starts, and attaches to containers for all services
+# 构建、创建、启动并附加到所有服务的容器 Builds, (re)creates, starts, and attaches to containers for all services
 docker-compose up
 
-# Builds, (re)creates, starts, and dettaches to containers for all services
+# 构建、创建、启动并分离所有服务的容器 Builds, (re)creates, starts, and detaches to containers for all services
 docker-compose up -d
 
-# Builds, (re)creates, starts, and attaches to containers for a service
+# 构建、创建、启动并附加到指定服务的容器 Builds, (re)creates, starts, and attaches to containers for a service
 docker-compose up -d <service_name>
 
-# Builds, (re)creates, starts, and dettaches to containers for a service
+# 构建、创建、启动并分离指定服务的容器 Builds, (re)creates, starts, and detaches to containers for a service
 docker-compose up -d <service_name>
 
-# Print the last lines of a service’s logs
+# 打印指定服务日志的最后 100 行 Print the last lines of a service’s logs
 docker-compose logs --tail 100 <service_name> | less
 
-# Print the last lines of a service's logs and following its logs
+# 打印指定服务日志的最后 100 行并持续跟踪日志 Print the last lines of a service's logs and following its logs
 docker-compose logs -f --tail 100 <service_name>
 
-# Stops containers and removes containers, networks created by up
+# 停止并删除由 `up` 创建的容器和网络 Stops containers and removes containers, networks created by up
 docker-compose down
+

+ 15 - 0
navi.cheat

@@ -2,3 +2,18 @@
 
 # 更新仓库 update repo
 navi repo add https://git.tianyunperfect.cn/tianyunperfect/cheats.git
+
+# 测试枚举
+echo <my_enum>
+
+$ my_enum: echo -e "选项1\n选项2\n选项3"
+
+# 测试fzf交互式选择
+echo <user>
+
+$ variable: w | fzf
+
+# 测试默认值
+echo <my_default>
+
+$ my_default: echo "我是默认值"