Skip to content

add environ()#2875

Closed
mattn wants to merge 21 commits intovim:masterfrom
mattn:getenv
Closed

add environ()#2875
mattn wants to merge 21 commits intovim:masterfrom
mattn:getenv

Conversation

@mattn
Copy link
Member

@mattn mattn commented May 5, 2018

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.

@mattn
Copy link
Member Author

mattn commented May 5, 2018

Do you think that this should return v:null for getenv("NOT_EXISTS")?

@codecov-io
Copy link

codecov-io commented May 5, 2018

Codecov Report

Merging #2875 into master will increase coverage by 0.01%.
The diff coverage is 86.11%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
src/evalfunc.c 88.43% <86.11%> (-0.02%) ⬇️
src/if_xcmdsrv.c 84.02% <0%> (-0.18%) ⬇️
src/ex_cmds2.c 84.89% <0%> (-0.1%) ⬇️
src/message.c 76.6% <0%> (ø) ⬆️
src/window.c 83.53% <0%> (ø) ⬆️
src/version.c 86.28% <0%> (ø) ⬆️
src/regexp_nfa.c 91.65% <0%> (+0.03%) ⬆️
src/eval.c 85.62% <0%> (+0.04%) ⬆️
src/ui.c 50.22% <0%> (+0.07%) ⬆️
src/terminal.c 78.29% <0%> (+0.08%) ⬆️
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bbd854d...b5798d0. Read the comment docs.

@mattn
Copy link
Member Author

mattn commented May 5, 2018

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.

@brammool
Copy link
Contributor

brammool commented May 5, 2018 via email

@mattn
Copy link
Member Author

mattn commented May 5, 2018

@brammool please look my last change. We will be possible to check the existence of environment variable.

@brammool
Copy link
Contributor

brammool commented May 5, 2018 via email

@mattn
Copy link
Member Author

mattn commented May 5, 2018

@brammool Okay, So, do you want to rename this to environ() ?

@brammool
Copy link
Contributor

brammool commented May 5, 2018 via email

@mattn
Copy link
Member Author

mattn commented May 5, 2018

Now renamed to environ()

@mattn mattn changed the title add getenv() add environ() May 6, 2018
@k-takata
Copy link
Member

k-takata commented May 7, 2018

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.

@brammool
Copy link
Contributor

brammool commented May 7, 2018 via email

@k-takata
Copy link
Member

k-takata commented May 9, 2018

Yeah, using getenv('ProgramFiles(x86)') might be easier than using environ()['ProgramFiles(x86)'] to get the value of the ProgramFiles(x86) environment variable.
(If getenv() is added, someone might also want setenv() for symmetricity. I'm not sure it is really needed.)

@mattn
Copy link
Member Author

mattn commented Feb 19, 2019

I changed environ() to use win32 wide string APIs since reflected that #4008 will be merged.

@brammool brammool closed this in 691ddee May 9, 2019
blueyed added a commit to blueyed/neovim that referenced this pull request Jul 30, 2019
…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
blueyed added a commit to blueyed/neovim that referenced this pull request Jul 30, 2019
…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
blueyed added a commit to blueyed/neovim that referenced this pull request Jul 30, 2019
…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
janlazo pushed a commit to janlazo/neovim that referenced this pull request Aug 5, 2019
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants