-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Kubecolor oc alias and zsh completions #6627
base: master
Are you sure you want to change the base?
Conversation
I think your commits got broken somehow, and you've lost the |
Whoops, you're right. I made a mistake rewriting history to run |
1a3371e
to
d373d8a
Compare
@ajgon ptal? |
modules/programs/kubecolor.nix
Outdated
oc = "env KUBECTL_COMMAND=${lib.getExe pkgs.openshift} ${ | ||
lib.getExe cfg.package | ||
}"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oc = "env KUBECTL_COMMAND=${lib.getExe pkgs.openshift} ${ | |
lib.getExe cfg.package | |
}"; | |
oc = lib.mkIf (lib.elem pkgs.openshift config.home-manager.users.ajgon.home.packages || lib.elem pkgs.openshift config.environment.systemPackages) "env KUBECTL_COMMAND=${lib.getExe pkgs.openshift} ${ | |
lib.getExe cfg.package | |
}"; |
I would add this alias only if user has openshift installed.
d373d8a
to
180ce5b
Compare
version = "5.9"; | ||
}; | ||
}; | ||
home.packages = [ pkgs.openshift ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ajgon I added some tests for the conditional addition of the oc
alias.
This is my first PR to nix-community. I'm not sure what the best way to test this would be. Is it bad to have pkgs.openshift
in the test here, instead of config.lib.test.mkStubPackage
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think mkStubPackage
will work better here, as it won't build whole derivation for openshift, just for testing. You can overload pkgs
with overlay i.e.
nixpkgs.overlays = [
(self: super: rec {
openshift = config.lib.test.mkStubPackage {
name = "openshift";
version = "4.16.0";
};
];
and keep the rest of your test as is. This should use stub instead of a real package, thus avoiding building deriv. 'm not at my laptop right now, so can't guarantee if it works, but in general that's the idea you should follow :-).
Description
oc
. See https://github.com/kubecolor/kubecolor/blob/main/README.md#whats-thisenableZshIntegration
which fixes ZSH completions forkubectl
(andoc
). See https://kubecolor.github.io/setup/shells/zsh/#completionsChecklist
Change is backwards compatible.
Code formatted with
./format
.Code tested through
nix-shell --pure tests -A run.all
or
nix build --reference-lock-file flake.lock ./tests#test-all
using Flakes.Test cases updated/added. See example.
Commit messages are formatted like
See CONTRIBUTING for more information and recent commit messages for examples.
If this PR adds a new module
Maintainer CC
@ajgon