{"id":24819030,"url":"https://github.com/nitive/kubectl-current-context","last_synced_at":"2025-03-25T20:37:27.203Z","repository":{"id":93116552,"uuid":"282421496","full_name":"Nitive/kubectl-current-context","owner":"Nitive","description":null,"archived":false,"fork":false,"pushed_at":"2021-08-07T13:36:10.000Z","size":21,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-22T07:56:58.497Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Nitive.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-07-25T10:29:00.000Z","updated_at":"2021-08-07T13:36:13.000Z","dependencies_parsed_at":"2023-06-04T23:30:18.496Z","dependency_job_id":null,"html_url":"https://github.com/Nitive/kubectl-current-context","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nitive%2Fkubectl-current-context","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nitive%2Fkubectl-current-context/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nitive%2Fkubectl-current-context/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nitive%2Fkubectl-current-context/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Nitive","download_url":"https://codeload.github.com/Nitive/kubectl-current-context/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245541321,"owners_count":20632286,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-30T17:56:03.283Z","updated_at":"2025-03-25T20:37:27.166Z","avatar_url":"https://github.com/Nitive.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# kubectl-current-context\n\nGet current kubectl context and namespace **super fast**. Useful for shell prompts.\n\n## Options\n\nGet context/namespace\n```\n$ kubectl-current-context -o slug\nmy-cluster/default\n```\n\nCustom separator with `-s` flag\n```\n$ kubectl-current-context -s='⎈'\nmy-cluster⎈default\n```\n\nJust context\n```\n$ kubectl-current-context -o context\nmy-cluster\n```\n\nJust namespace\n```\n$ kubectl-current-context -o namespace\ndefault\n```\n\nJSON\n```\n$ kubectl-current-context -o json\n{\"context\":\"my-cluster\",\"namespace\":\"default\"}\n```\n\n## Benchmarks\n\nNative kubectl commands to get current context and namespace take ~136ms to run\n\n```\n$ kubectl config current-context\n$ kubectl config view --minify --output \"jsonpath={..namespace}\"\n```\n\n```\nBenchmark #1: kubectl config current-context \u0026\u0026 kubectl config view --minify --output \"jsonpath={..namespace}\"\n  Time (mean ± σ):     135.7 ms ±   6.9 ms    [User: 139.9 ms, System: 30.5 ms]\n  Range (min … max):   123.3 ms … 164.4 ms    100 runs\n```\n\nThis implementation takes only ~7ms — 1884% faster\n\n```\n$ kubectl-current-context -o json\n```\n\n```\nBenchmark #1: ./kubectl-current-context -o json\n  Time (mean ± σ):       7.2 ms ±   3.0 ms    [User: 6.3 ms, System: 6.0 ms]\n  Range (min … max):     4.9 ms …  34.7 ms    100 runs\n```\n\n# Installation\n\nDownload [latest release](https://github.com/Nitive/kubectl-current-context/releases/latest) binary and put it in your /usr/local/bin directory\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnitive%2Fkubectl-current-context","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnitive%2Fkubectl-current-context","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnitive%2Fkubectl-current-context/lists"}