FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
git-exec/command/command.go at main · akm/git-exec · GitHub
akm
/
git-exec
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
8
Pull requests
1
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
git-exec
/
command
/
command.go
Copy path
More file actions
More file actions
Latest commit
History
History
History
33 lines (29 loc) · 556 Bytes
Breadcrumbs
git-exec
/
command
/
command.go
Copy path
File metadata and controls
33 lines (29 loc) · 556 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
package
command
import
(
"strings"
)
type
Command
struct
{
Envs
[]
string
Args
[]
string
Output
string
}
func
NewCommand
(
args
[]
string
)
*
Command
{
envs
,
commandArgs
:=
splitArgsToEnvsAndCommand
(
args
)
return
&
Command
{
Envs
:
envs
,
Args
:
commandArgs
,
}
}
func
splitArgsToEnvsAndCommand
(
args
[]
string
) ([]
string
, []
string
) {
notEnvFound
:=
false
var
a
,
b
[]
string
for
_
,
arg
:=
range
args
{
if
!
notEnvFound
&&
strings
.
Contains
(
arg
,
"="
) {
a
=
append
(
a
,
arg
)
}
else
{
b
=
append
(
b
,
arg
)
notEnvFound
=
true
}
}
return
a
,
b
}
Back
|
FazBrowse Home
|
New Git URL