Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
ximperconf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ximper Linux
ximperconf
Commits
6eeca1f8
Commit
6eeca1f8
authored
Jan 13, 2026
by
Kirill Unitsaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
preset/files: use config.OpStatus instead of local constants
parent
d4a24afc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
20 deletions
+13
-20
files.go
preset/files.go
+13
-20
No files found.
preset/files.go
View file @
6eeca1f8
...
@@ -5,10 +5,10 @@ import (
...
@@ -5,10 +5,10 @@ import (
"os/exec"
"os/exec"
"path/filepath"
"path/filepath"
"strings"
"strings"
"ximperconf/config"
)
)
type
opKind
string
type
opKind
string
type
opStatus
string
const
(
const
(
OpCopy
opKind
=
"copy"
OpCopy
opKind
=
"copy"
...
@@ -16,13 +16,6 @@ const (
...
@@ -16,13 +16,6 @@ const (
OpReplace
opKind
=
"replace"
OpReplace
opKind
=
"replace"
)
)
const
(
StatusDone
opStatus
=
"done"
StatusSkipped
opStatus
=
"skipped"
StatusDryRun
opStatus
=
"dry-run"
StatusError
opStatus
=
"error"
)
type
opOptions
struct
{
type
opOptions
struct
{
DryRun
bool
DryRun
bool
Force
bool
Force
bool
...
@@ -30,7 +23,7 @@ type opOptions struct {
...
@@ -30,7 +23,7 @@ type opOptions struct {
type
opResult
struct
{
type
opResult
struct
{
Kind
opKind
Kind
opKind
Status
op
Status
Status
config
.
Item
Status
Source
string
Source
string
Target
string
Target
string
Reason
string
Reason
string
...
@@ -47,7 +40,7 @@ func copyIfMissing(src, dest string, opts opOptions) opResult {
...
@@ -47,7 +40,7 @@ func copyIfMissing(src, dest string, opts opOptions) opResult {
if
err
!=
nil
{
if
err
!=
nil
{
return
opResult
{
return
opResult
{
Kind
:
OpCopy
,
Kind
:
OpCopy
,
Status
:
Status
Error
,
Status
:
config
.
OpStatus
.
Error
,
Source
:
src
,
Source
:
src
,
Target
:
dest
,
Target
:
dest
,
Reason
:
err
.
Error
(),
Reason
:
err
.
Error
(),
...
@@ -57,7 +50,7 @@ func copyIfMissing(src, dest string, opts opOptions) opResult {
...
@@ -57,7 +50,7 @@ func copyIfMissing(src, dest string, opts opOptions) opResult {
if
_
,
err
:=
os
.
Stat
(
dest
);
err
==
nil
{
if
_
,
err
:=
os
.
Stat
(
dest
);
err
==
nil
{
return
opResult
{
return
opResult
{
Kind
:
OpCopy
,
Kind
:
OpCopy
,
Status
:
Status
Skipped
,
Status
:
config
.
OpStatus
.
Skipped
,
Target
:
dest
,
Target
:
dest
,
Reason
:
"already exists"
,
Reason
:
"already exists"
,
}
}
...
@@ -66,7 +59,7 @@ func copyIfMissing(src, dest string, opts opOptions) opResult {
...
@@ -66,7 +59,7 @@ func copyIfMissing(src, dest string, opts opOptions) opResult {
if
opts
.
DryRun
{
if
opts
.
DryRun
{
return
opResult
{
return
opResult
{
Kind
:
OpCopy
,
Kind
:
OpCopy
,
Status
:
Status
DryRun
,
Status
:
config
.
OpStatus
.
DryRun
,
Source
:
src
,
Source
:
src
,
Target
:
dest
,
Target
:
dest
,
}
}
...
@@ -81,7 +74,7 @@ func copyIfMissing(src, dest string, opts opOptions) opResult {
...
@@ -81,7 +74,7 @@ func copyIfMissing(src, dest string, opts opOptions) opResult {
if
err
!=
nil
{
if
err
!=
nil
{
return
opResult
{
return
opResult
{
Kind
:
OpCopy
,
Kind
:
OpCopy
,
Status
:
Status
Error
,
Status
:
config
.
OpStatus
.
Error
,
Source
:
src
,
Source
:
src
,
Target
:
dest
,
Target
:
dest
,
Reason
:
err
.
Error
(),
Reason
:
err
.
Error
(),
...
@@ -90,7 +83,7 @@ func copyIfMissing(src, dest string, opts opOptions) opResult {
...
@@ -90,7 +83,7 @@ func copyIfMissing(src, dest string, opts opOptions) opResult {
return
opResult
{
return
opResult
{
Kind
:
OpCopy
,
Kind
:
OpCopy
,
Status
:
Status
Done
,
Status
:
config
.
OpStatus
.
Done
,
Source
:
src
,
Source
:
src
,
Target
:
dest
,
Target
:
dest
,
}
}
...
@@ -133,7 +126,7 @@ func createLinkIfMissing(src, dest string, opts opOptions) opResult {
...
@@ -133,7 +126,7 @@ func createLinkIfMissing(src, dest string, opts opOptions) opResult {
if
_
,
err
:=
os
.
Stat
(
src
);
os
.
IsNotExist
(
err
)
{
if
_
,
err
:=
os
.
Stat
(
src
);
os
.
IsNotExist
(
err
)
{
return
opResult
{
return
opResult
{
Kind
:
OpLink
,
Kind
:
OpLink
,
Status
:
Status
Skipped
,
Status
:
config
.
OpStatus
.
Skipped
,
Target
:
dest
,
Target
:
dest
,
Reason
:
"source missing"
,
Reason
:
"source missing"
,
}
}
...
@@ -142,7 +135,7 @@ func createLinkIfMissing(src, dest string, opts opOptions) opResult {
...
@@ -142,7 +135,7 @@ func createLinkIfMissing(src, dest string, opts opOptions) opResult {
if
_
,
err
:=
os
.
Lstat
(
dest
);
err
==
nil
{
if
_
,
err
:=
os
.
Lstat
(
dest
);
err
==
nil
{
return
opResult
{
return
opResult
{
Kind
:
OpLink
,
Kind
:
OpLink
,
Status
:
Status
Skipped
,
Status
:
config
.
OpStatus
.
Skipped
,
Target
:
dest
,
Target
:
dest
,
Reason
:
"already exists"
,
Reason
:
"already exists"
,
}
}
...
@@ -151,7 +144,7 @@ func createLinkIfMissing(src, dest string, opts opOptions) opResult {
...
@@ -151,7 +144,7 @@ func createLinkIfMissing(src, dest string, opts opOptions) opResult {
if
opts
.
DryRun
{
if
opts
.
DryRun
{
return
opResult
{
return
opResult
{
Kind
:
OpLink
,
Kind
:
OpLink
,
Status
:
Status
DryRun
,
Status
:
config
.
OpStatus
.
DryRun
,
Source
:
src
,
Source
:
src
,
Target
:
dest
,
Target
:
dest
,
}
}
...
@@ -160,7 +153,7 @@ func createLinkIfMissing(src, dest string, opts opOptions) opResult {
...
@@ -160,7 +153,7 @@ func createLinkIfMissing(src, dest string, opts opOptions) opResult {
if
err
:=
os
.
MkdirAll
(
filepath
.
Dir
(
dest
),
0755
);
err
!=
nil
{
if
err
:=
os
.
MkdirAll
(
filepath
.
Dir
(
dest
),
0755
);
err
!=
nil
{
return
opResult
{
return
opResult
{
Kind
:
OpLink
,
Kind
:
OpLink
,
Status
:
Status
Error
,
Status
:
config
.
OpStatus
.
Error
,
Reason
:
err
.
Error
(),
Reason
:
err
.
Error
(),
}
}
}
}
...
@@ -168,14 +161,14 @@ func createLinkIfMissing(src, dest string, opts opOptions) opResult {
...
@@ -168,14 +161,14 @@ func createLinkIfMissing(src, dest string, opts opOptions) opResult {
if
err
:=
os
.
Symlink
(
src
,
dest
);
err
!=
nil
{
if
err
:=
os
.
Symlink
(
src
,
dest
);
err
!=
nil
{
return
opResult
{
return
opResult
{
Kind
:
OpLink
,
Kind
:
OpLink
,
Status
:
Status
Error
,
Status
:
config
.
OpStatus
.
Error
,
Reason
:
err
.
Error
(),
Reason
:
err
.
Error
(),
}
}
}
}
return
opResult
{
return
opResult
{
Kind
:
OpLink
,
Kind
:
OpLink
,
Status
:
Status
Done
,
Status
:
config
.
OpStatus
.
Done
,
Source
:
src
,
Source
:
src
,
Target
:
dest
,
Target
:
dest
,
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment