Conversation
|
Do you think that this should return v:null for |
Codecov Report
@@ Coverage Diff @@
## master #2875 +/- ##
==========================================
+ Coverage 79.13% 79.15% +0.01%
==========================================
Files 105 105
Lines 141111 141162 +51
==========================================
+ Hits 111669 111731 +62
+ Misses 29442 29431 -11
Continue to review full report at Codecov.
|
|
Changed to return v:null for non-existence variable. And added test. But now will fail. This will be succeeded if #2855 will be merged. |
|
Yasuhiro Matsumoto wrote:
This pull-request add getenv() to add a way to get environment
variable or variables. `getenv("FOO")` works as same as $FOO.
`getenv()` return dictionary of pairs of key and value. If you have
interest in this, I'll add test. But for the test,
#2855 is required.
Since $VAR already works to get the value of an environment variable,
does it make sense to have another way with getenv('VAR')?
Perhaps getenv() should just always return a dictionary with all of
them.
…--
WOMAN: I didn't know we had a king. I thought we were an autonomous
collective.
DENNIS: You're fooling yourself. We're living in a dictatorship. A
self-perpetuating autocracy in which the working classes--
WOMAN: Oh there you go, bringing class into it again.
DENNIS: That's what it's all about if only people would--
The Quest for the Holy Grail (Monty Python)
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|
|
@brammool please look my last change. We will be possible to check the existence of environment variable. |
|
@brammool please look my last change. We will be possible to check the
existence of environment variable.
Well, but on most systems an empty environment variable should be
handled the same as non-existence. I don't see much point in adding
something where the difference matters. Seems like a theoretical
difference without practical use.
If getenv() returns a dict with all environment variables, then if you
really want you can tell the difference. It's more code, but then it
would almost never be needed.
…--
Individualists unite!
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|
|
@brammool Okay, So, do you want to rename this to |
|
@brammool Okay, So, do you want to rename this to `environ()` ?
I suppose that's better than getenv(), which has a meaning in most
programs. In Unix "environ" is a variable, but using that for a
function name should be OK. In Python it's os.environ.
Alternative is environment(). Hmm, perhaps that's better? Or we could
keep it short: env().
…--
ARTHUR: Then who is your lord?
WOMAN: We don't have a lord.
ARTHUR: What?
DENNIS: I told you. We're an anarcho-syndicalist commune. We take it in
turns to act as a sort of executive officer for the week.
The Quest for the Holy Grail (Monty Python)
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|
|
Now renamed to environ() |
|
This might be used for a workaround for the following todo item:
|
|
Ken Takata wrote:
This might be used for a workaround for the following todo item:
> Can't recognize the $ProgramFiles(x86) environment variable. Recognize it
> specifically? First try with the parens, then without.
You mean to pass the name to the getenv() function?
It's a very specific usage, but I suppose it's better than trying to
parse the name when used in $VAR form.
We could still use environ() to get the dictionary and getenv(name) to
get the value of one. Main reason is that the type of the return value
differs.
…--
f y cn rd ths thn y cn hv grt jb n cmptr prgrmmng
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|
|
Yeah, using |
|
I changed |
…riables
Problem: There is no easy way to manipulate environment variables.
Solution: Add environ(), getenv() and setenv(). (Yasuhiro Matsumoto,
closes vim/vim#2875)
vim/vim@691ddee
…riables
Problem: There is no easy way to manipulate environment variables.
Solution: Add environ(), getenv() and setenv(). (Yasuhiro Matsumoto,
closes vim/vim#2875)
vim/vim@691ddee
…riables
Problem: There is no easy way to manipulate environment variables.
Solution: Add environ(), getenv() and setenv(). (Yasuhiro Matsumoto,
closes vim/vim#2875)
vim/vim@691ddee
…riables
Problem: There is no easy way to manipulate environment variables.
Solution: Add environ(), getenv() and setenv(). (Yasuhiro Matsumoto,
closes vim/vim#2875)
vim/vim@691ddee
This pull-request add getenv() to add a way to get environment variable or variables.
getenv("FOO")works as same as $FOO.getenv()return dictionary of pairs of key and value. If you have interest in this, I'll add test. But for the test, #2855 is required.