diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/server/infrastructure/CliConvenience.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/server/infrastructure/CliConvenience.kt index 25206f7..5accaf0 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/server/infrastructure/CliConvenience.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/server/infrastructure/CliConvenience.kt @@ -2,13 +2,28 @@ package org.domaindrivenarchitecture.provs.server.infrastructure import org.domaindrivenarchitecture.provs.framework.core.Prov import org.domaindrivenarchitecture.provs.framework.core.ProvResult +import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.createFile +import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.createFileFromResource + +private const val resourcePath = "org/domaindrivenarchitecture/provs/desktop/infrastructure" fun Prov.provisionServerCliConvenience() = task { provisionKubectlCompletionAndAlias() + provisionVimrc() + provisionKubeEditor() } fun Prov.provisionKubectlCompletionAndAlias(): ProvResult = task { cmd("kubectl completion bash | sudo tee /etc/bash_completion.d/kubectl > /dev/null") - cmd("echo 'alias k=kubectl' >>~/.bashrc") + cmd("echo 'alias k=kubectl' >> ~/.bashrc") cmd("echo 'complete -o default -F __start_kubectl k' >>~/.bashrc") +} + +fun Prov.provisionVimrc(): ProvResult = task { + createFileFromResource("~/.vimrc",".vimrc", resourcePath) +} + +fun Prov.provisionKubeEditor(): ProvResult = task { + cmd("echo '' >> ~/.profile") + cmd("echo 'export KUBE_EDITOR=vim' >> ~/.profile") } \ No newline at end of file diff --git a/src/main/resources/org/domaindrivenarchitecture/provs/desktop/infrastructure/.vimrc b/src/main/resources/org/domaindrivenarchitecture/provs/desktop/infrastructure/.vimrc new file mode 100644 index 0000000..d3ef7c5 --- /dev/null +++ b/src/main/resources/org/domaindrivenarchitecture/provs/desktop/infrastructure/.vimrc @@ -0,0 +1,25 @@ +filetype plugin indent on +syntax on + +" set permanent line numbering +set number relativenumber + +" we want to know exact position +set ruler + +" control tabwidth to be 2 tabs wide +set expandtab +set shiftwidth=2 +set softtabstop=2 + +" keep indentation level +set autoindent + +" map two semicolons to escape key +:inoremap ;; + +" let new window splits happen below +set splitbelow + +" command for terminal creation below all splits +:command Bterm botright terminal