|
35 | 35 |
|
36 | 36 | Read about installing `envfetch` in the [Wiki](https://github.com/ankddev/envfetch/wiki/2.-Installation).
|
37 | 37 | ## Using
|
38 |
| -To run envfetch, run `envfetch <COMMAND> <ARGS>` in your terminal. |
39 |
| -You can run `envfetch help` to see help message or `envfetch --version` to see program's version. |
40 |
| - |
41 |
| -### Command list |
42 |
| -#### Interactive |
43 |
| -> [!NOTE] |
44 |
| -> Interactive mode is currently WIP and only list variables is available. |
45 |
| -> See for progress in https://github.com/ankddev/envfetch/issues/17. Also it isn't in latest released ersion `v1.4.0`, if you want to test it, |
46 |
| -> wait for `v2.0.0` or build `envfetch` from source yourself |
47 |
| -
|
48 |
| -Run interactive mode with TUI. |
49 |
| - |
50 |
| -Usage: |
51 |
| -`envfetch interactive` |
52 |
| - |
53 |
| -This will start TUI, where you will be able to work with environment variables. |
54 |
| -#### Init config |
55 |
| -Initialize config file for `envfetch`. |
56 |
| - |
57 |
| -Usage: |
58 |
| -`envfetch init-config` |
59 |
| - |
60 |
| -Options: |
61 |
| -- `--help`/`-h` - showw help message. |
62 |
| - |
63 |
| -> [!WARNING] |
64 |
| -> Currently this command will overwrite any existing config file! |
65 |
| -#### Set |
66 |
| -Set environment variable and optionally run process. |
67 |
| - |
68 |
| -Usage: |
69 |
| -`envfetch set <KEY> <VALUE> [-- <PROCESS>]`, where: |
70 |
| -- `KEY` - name of environment variable |
71 |
| -- `VALUE` - value of environment variable |
72 |
| -- `PROCESS` - name of process which you want to run (optional if --global is used) |
73 |
| - |
74 |
| -Options: |
75 |
| -- `--help`/`-h` - show help message |
76 |
| -- `--global`/`-g` - set variable permanently in system environment |
77 |
| - - On Windows: stores in registry |
78 |
| - - On Unix: stores in shell config (.bashrc, .zshrc, or config.fish) |
79 |
| - |
80 |
| -For example: |
81 |
| -```shell |
82 |
| -$ envfetch set MY_VAR "Hello" -- "npm run" # temporary for process |
83 |
| -$ envfetch set MY_VAR "Hello" --global # permanent system-wide |
84 |
| -``` |
85 |
| -#### Add |
86 |
| -Add value to the end of environment variable and optionally run the process |
87 |
| - |
88 |
| -Usage: |
89 |
| -`envfetch add <KEY> <VALUE> [-- <PROCESS>]`, where: |
90 |
| -- `KEY` - name of environment variable |
91 |
| -- `VALUE` - value of environment variable to add |
92 |
| -- `PROCESS` - name of process which you want to run (optional if --global is used) |
93 |
| - |
94 |
| -Options: |
95 |
| -- `--help`/`-h` - show help message |
96 |
| -- `--global`/`-g` - update variable permanently in system environment |
97 |
| - - On Windows: stores in registry |
98 |
| - - On Unix: stores in shell config (.bashrc, .zshrc, or config.fish) |
99 |
| - |
100 |
| -For example: |
101 |
| -```shell |
102 |
| -$ envfetch add PATH "../hello.exe" -- "cargo run" # temporary for process |
103 |
| -$ envfetch add MY_VAR "Hello" --global # permanent system-wide |
104 |
| -``` |
105 |
| -#### Print |
106 |
| -Print all environment variables |
107 |
| - |
108 |
| -Usage: |
109 |
| -`envfetch print` |
110 |
| - |
111 |
| -Options: |
112 |
| -- `--help`/`-h` - show help message |
113 |
| -- `--format <FORMAT>`/`-f <FORMAT>` - set custom format. |
114 |
| - |
115 |
| -By default, it uses format `{name} - "{value}"`. In format string `{name}` is replaced with name of the variable and `{value}` is replaced with it's value. |
116 |
| - |
117 |
| -For example: |
118 |
| -```shell |
119 |
| -$ envfetch print |
120 |
| -SHELL = "powershell" |
121 |
| -windir = "C:\\Windows" |
122 |
| -SystemDrive = "C:" |
123 |
| -SystemRoot = "C:\\Windows" |
124 |
| -... |
125 |
| -``` |
126 |
| -```shell |
127 |
| -$ envfetch print --format "{name}: {value};" |
128 |
| -SHELL: powershell; |
129 |
| -windir: C:\\Windows; |
130 |
| -SystemDrive: C:; |
131 |
| -SystemRoot: C:\\Windows; |
132 |
| -... |
133 |
| -``` |
134 |
| -It will print all environment variables in given format. |
135 |
| -#### Get |
136 |
| -Get value of environment variable |
137 |
| - |
138 |
| -Usage: |
139 |
| -`envfetch get <KEY>`, where: |
140 |
| -- `KEY` - name of environment variable |
141 |
| - |
142 |
| -Options: |
143 |
| -- `--help`/`-h` - show help message |
144 |
| -- `--no-similar-names`/`-s` - disable showing similar variables if variable not |
145 |
| - |
146 |
| -For example: |
147 |
| -```shell |
148 |
| -$ envfetch get MY_VAR |
149 |
| -"Hello" |
150 |
| -``` |
151 |
| -It will print value of specified variable. |
152 |
| -#### Delete |
153 |
| -Delete variable and optionally start process. |
154 |
| - |
155 |
| -Usage: |
156 |
| -`envfetch delete <KEY> [-- <PROCESS>]`, where: |
157 |
| -- `KEY` - name of environment variable |
158 |
| -- `PROCESS` - name of command to run (optional if --global is used) |
159 |
| - |
160 |
| -Options: |
161 |
| -- `--help`/`-h` - show help message |
162 |
| -- `--global`/`-g` - delete variable permanently from system environment |
163 |
| - |
164 |
| -For example: |
165 |
| -```shell |
166 |
| -$ envfetch delete MY_VAR -- "npm run" # temporary for process |
167 |
| -$ envfetch delete MY_VAR --global # permanent system-wide |
168 |
| -``` |
169 |
| - |
170 |
| -#### Load |
171 |
| -Load environment variables from dotenv-style file and optionally run process. |
172 |
| - |
173 |
| -Usage: |
174 |
| -`envfetch load [PROCESS]`, where: |
175 |
| -- `PROCESS` - name of process which you want to run (optional if --global is used) |
176 |
| - |
177 |
| -Options: |
178 |
| -- `--help`/`-h` - show help message |
179 |
| -- `--file <FILE>`/`-f <FILE>` - relative or absolute path to file to read variables from. Note that it must be in .env format. |
180 |
| -By default, program loads variables from `.env` file in current directory. |
181 |
| -- `--global`/`-g` - load variables permanently into system environment |
182 |
| - |
183 |
| -For example: |
184 |
| -```shell |
185 |
| -$ envfetch load -- "npm run" # temporary for process |
186 |
| -$ envfetch load --global # permanent system-wide |
187 |
| -$ envfetch load --global --file .env.prod # permanent from specific file |
188 |
| -``` |
189 |
| - |
190 |
| -> [!NOTE] |
191 |
| -> When using `--global` flag: |
192 |
| -> - On Windows, variables are stored in the registry under HKEY_CURRENT_USER\Environment |
193 |
| -> - On Unix-like systems, variables are stored in shell configuration files (.bashrc, .zshrc, or config.fish) |
194 |
| -> |
195 |
| -> Without `--global` flag, variables are only set for the current process run |
| 38 | +Read in [Wiki](https://github.com/ankddev/envfetch/wiki/3.-Basic-Usage). |
196 | 39 | ## Configuration
|
197 | 40 | `envfetch` support some configuration. Fitsly, you need to run `envfetch init-config` to create config file, it will return you path of config.
|
198 | 41 | | Platform | Path |
|
|
0 commit comments