-
Notifications
You must be signed in to change notification settings - Fork 0
/
srcenv.1
160 lines (160 loc) · 3.48 KB
/
srcenv.1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
.\" Automatically generated by Pandoc 3.6
.\"
.TH "SRCENV" "1" "December 2024" "srcenv 1.5.4" "General Commands Manual"
.SH NAME
\f[B]srcenv\f[R] \[em] cross\-shell tool for sourcing POSIX compliant
\&.env scripts
.SH SYNOPSIS
.PP
\f[B]srcenv\f[R] <\f[I]shell\f[R]> [\f[I]options\f[R]] [\f[I]files\f[R]]
.PD 0
.P
.PD
\f[B]srcenv\f[R] init <\f[I]shell\f[R]>
.PD 0
.P
.PD
\f[B]srcenv\f[R]
[\f[B]\-h\f[R]|\f[B]\-\-help\f[R]|\f[B]\-v\f[R]|\f[B]\-\-version\f[R]]
.SH DESCRIPTION
srcenv takes a snapshot of the POSIX shell environment, sources the .env
scripts and prints a shell specific script exporting the environment
variables that have changed since the snapshot.
.PP
srcenv depends on jq(1) being available; see \c
.UR https://jqlang.github.io/jq
.UE \c
\ for installation options.
.SS Commands
.TP
init
Generate the initialization script.
.SS Shells
.TP
ash, dash
Format the output as an Ash/Dash script.
.TP
bash
Format the output as a Bash script.
.TP
bat, cmd
Format the output as a Windows batch script.
.TP
csh, tcsh
Format the output as a Csh/Tcsh script.
.TP
elvish
Format the output as an Elvish script.
.TP
env
Format the output as a .env file.
.TP
fish
Format the output as a Fish script.
.TP
json
Format the output as JSON.
.TP
ksh, pdksh, mksh
Format the output as a Ksh script.
.TP
murex
Format the output as a Murex script.
.TP
launchctl
Format the output as a launchctl calls (macOS).
.TP
nu, nushell
Format the output as a Nushell script.
.TP
posix, sh
Format the output as a POSIX shell script.
.TP
pwsh, powershell
Format the output as a PowerShell script.
.TP
zsh
Format the output as a Zsh script.
.SS Options
.TP
\-f FORMAT, \-f=FORMAT, \-\-format FORMAT, \-\-format=FORMAT
Format the output as anything (jq interpolated string).
For details, see FORMAT section below.
.TP
\-
Source from STDIN.
.TP
\-i INPUT, \-i=INPUT, \-\-input INPUT, \-\-input=INPUT
Source from string value of INPUT.
.TP
\-b, \-\-backup
Backup changes to SRCENV_RESTORE for restore.
.TP
\-r, \-\-restore
Restore backed up changes from SRCENV_RESTORE.
.TP
\-e, \-\-export
Export all variables (Default for .env/.envrc files).
.TP
\-l, \-\-local
Do not export all variables.
.TP
\-s, \-\-sort
Sort the environment variables alphabetically (Default).
.TP
\-u, \-\-unsorted
Keep the environment variables unsorted.
.TP
\-h, \-\-help
Display help and exit.
.TP
\-v, \-\-version
Display the version number and exit.
.SH EXAMPLES
The following examples show how to source \f[CR].env\f[R] in different
shells:
.TP
Bash:
\f[CR]source <(srcenv bash .env)\f[R]
.TP
Fish:
\f[CR]srcenv fish .env | source\f[R]
.TP
PowerShell:
\f[CR]Invoke\-Expression (&srcenv pwsh .env)\f[R]
.TP
Zsh:
\f[CR]source <(srcenv zsh .env)\f[R]
.SH FORMAT
The format is a jq(1) interpolated string
\f[CR]\[ga]\f[R]\[rs](\&...)\f[CR]\[ga]\f[R] where the key is
\f[CR]\[ga]\f[R]$k\f[CR]\[ga]\f[R], and the value
\f[CR]\[ga]\f[R].[$k]\f[CR]\[ga]\f[R].
A second interpolated string can be appended with the
\f[CR]\[ga]\f[R]??\f[CR]\[ga]\f[R] delimiter to format null values
\f[I](unset environment variables)\f[R].
.TP
Key:
\f[CR]\[rs]($k)\f[R]
.TP
Value:
\f[CR]\[rs](.[$k])\f[R]
.TP
Single quoted value:
\f[CR](.[$k]|\[at]sh)\f[R]
.TP
Double quoted value:
\f[CR](.[$k]|\[at]json)\f[R]
.TP
POSIX format:
\f[CR]export \[rs]($k)=\[rs](.[$k]|\[at]sh)??unset \[rs]($k)\f[R]
.SH SEE ALSO
Repository: https://github.com/ins0mniaque/srcenv
.PP
\f[B]sh(1)\f[R], \f[B]jq(1)\f[R]
.SH AUTHOR
Jean\-Philippe Leconte \c
.ME \c
.SH BUGS
See GitHub Issues: https://github.com/ins0mniaque/srcenv/issues