Git Product home page Git Product logo

Comments (3)

davidkna avatar davidkna commented on September 26, 2024 4

I submitted a PR that should hopefully fix this: #5979

from starship.

jankatins avatar jankatins commented on September 26, 2024 2

https://github.com/andytom/starship/blob/cce9d335095a10e7f53cb5c6e54d27d3ce8ac1e1/src/context.rs#L247C1-L252C10

    /// Returns true if `detect_env_vars` is empty,
    /// or if at least one environment variable is set and no negated environment variable is set
    pub fn detect_env_vars(&'a self, env_vars: &'a [&'a str]) -> bool {
        if env_vars.is_empty() {
            return true;
        }

-> if it is unset, it default to "enable", making the check

https://github.com/andytom/starship/blob/4b1cda66417cec0ff146dadf8c673ef7198e919a/src/modules/kubernetes.rs#L132C1-L135C1

    if !is_kube_project.unwrap_or(true) && !have_env_vars {
        return None;
    }

always enabling the module.

I guess the fix is intergrating the detect_env_var into the scanner so one can set the default in case all detection variants (files, folders, extensions, env vars) are unset, instead of setting it separately for files/folders/extension and env vars.

A workaround if you only want to get triggered by a file is set the env var to something invalid:

[kubernetes]
disabled = false
detect_files = ['.k8s']
# Not setting it would enable it always in v1.19.0: https://github.com/starship/starship/issues/5978
detect_env_vars = ['INVALID']

from starship.

jankatins avatar jankatins commented on September 26, 2024

I can confirm this behavior: it was fine with 1.18.2, but now the above happens in 1.19.0.

(EDIT: Earlier it seemed to me that python also exposes this behavior, but there it was due to the detection of the activated env)

from starship.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.