From 90419010cf3d96dbd8ba94598c57b98c1fccd050 Mon Sep 17 00:00:00 2001 From: Jiri Konecny Date: Wed, 18 Nov 2020 10:37:44 +0100 Subject: [PATCH] Add support for OCI containers (podman) This is an rootless alternative to docker container tool. It has a bunch of benefits. For more information see: https://podman.io/ The main reason why to have this support is `toolbox` tool which is used as a primary tool for development on immutable system (not-only) such as Fedora SilverBlue. The immutability of the system is replaced by creating containers for projects and work inside these containers. For more info see: https://docs.fedoraproject.org/en-US/fedora-silverblue/toolbox/ It's really nice to have this feature here because toolbox will use configuration of the system in the container as it is in host so it's pretty reasonable to use fish inside the container but know that I'm in the container right now. --- README.md | 2 ++ functions/fish_prompt.fish | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/README.md b/README.md index 85a6550..1bfcb5c 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,7 @@ set -g theme_git_worktree_support yes set -g theme_use_abbreviated_branch_name yes set -g theme_display_vagrant yes set -g theme_display_docker_machine no +set -g theme_display_oci_container no set -g theme_display_k8s_context yes set -g theme_display_hg yes set -g theme_display_virtualenv no @@ -126,6 +127,7 @@ set -g theme_newline_prompt '$ ' - `theme_display_ruby`. Use `no` to completely hide all information about Ruby version. By default Ruby version displayed if there is the difference from default settings. - `theme_display_node`. If set to `yes`, will display current NVM or FNM node version. - `theme_display_vagrant`. This feature is disabled by default, use `yes` to display Vagrant status in your prompt. Please note that only the VirtualBox and VMWare providers are supported. +- `theme_display_oci_container`. This feature is disabled by default, use `yes` to display container management tool (`podman`) when you are in the oci supported container. - `theme_display_vi`. By default the vi mode indicator will be shown if vi or hybrid key bindings are enabled. Use `no` to hide the indicator, or `yes` to show the indicator. - `theme_display_k8s_context`. This feature is disabled by default. Use `yes` to show the current kubernetes context (`> kubectl config current-context`). - `theme_display_k8s_namespace`. This feature is disabled by default. Use `yes` to show the current kubernetes namespace. diff --git a/functions/fish_prompt.fish b/functions/fish_prompt.fish index 02bfe97..9bc41e9 100644 --- a/functions/fish_prompt.fish +++ b/functions/fish_prompt.fish @@ -28,6 +28,7 @@ # set -g theme_git_worktree_support yes # set -g theme_display_vagrant yes # set -g theme_display_docker_machine no +# set -g theme_display_oci_container no # set -g theme_display_k8s_context yes # set -g theme_display_k8s_namespace no # set -g theme_display_aws_vault_profile yes @@ -599,6 +600,14 @@ function __bobthefish_prompt_docker -S -d 'Display Docker machine name' echo -ns $DOCKER_MACHINE_NAME ' ' end +function __bobthefish_prompt_oci_container -S -d 'Display oci container tool (podman)' + [ "$theme_display_oci_container" = 'no' -o -z "$container" ] + and return + + __bobthefish_start_segment $color_vagrant + echo -ns $container ' ' +end + function __bobthefish_k8s_context -S -d 'Get the current k8s context' set -l config_paths "$HOME/.kube/config" [ -n "$KUBECONFIG" ] @@ -1130,6 +1139,7 @@ function fish_prompt -d 'bobthefish, a fish theme optimized for awesome' # Containers and VMs __bobthefish_prompt_vagrant __bobthefish_prompt_docker + __bobthefish_prompt_oci_container __bobthefish_prompt_k8s_context # Cloud Tools