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
f079c7dc
Verified
Commit
f079c7dc
authored
Aug 25, 2025
by
Kirill Unitsaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add repo subcommands
parent
e9c9e566
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
125 additions
and
0 deletions
+125
-0
config.go
config/config.go
+9
-0
main.go
main.go
+2
-0
actions.go
repo/actions.go
+81
-0
commands.go
repo/commands.go
+33
-0
No files found.
config/config.go
View file @
f079c7dc
...
...
@@ -11,9 +11,14 @@ type HyprEnv struct {
UserModulesDir
string
}
type
RepoEnv
struct
{
DeferredInfoURL
string
}
type
Environment
struct
{
Version
string
Hyprland
*
HyprEnv
Repo
*
RepoEnv
}
var
Env
Environment
...
...
@@ -52,5 +57,9 @@ func InitConfig() error {
}
}
Env
.
Repo
=
&
RepoEnv
{
DeferredInfoURL
:
"https://download.etersoft.ru/pub/Etersoft/Sisyphus/Deferred_Info.html"
,
}
return
nil
}
main.go
View file @
f079c7dc
...
...
@@ -5,6 +5,7 @@ import (
"os"
"ximperconf/config"
"ximperconf/hyprland"
"ximperconf/repo"
"github.com/urfave/cli/v3"
)
...
...
@@ -19,6 +20,7 @@ func main() {
EnableShellCompletion
:
true
,
Version
:
config
.
Env
.
Version
,
Commands
:
[]
*
cli
.
Command
{
repo
.
CommandList
(),
hyprland
.
CommandList
(),
{
Name
:
"help"
,
...
...
repo/actions.go
0 → 100644
View file @
f079c7dc
package
repo
import
(
"ximperconf/config"
"context"
"fmt"
"io"
"net/http"
"os"
"regexp"
"github.com/fatih/color"
"github.com/urfave/cli/v3"
)
var
(
reLastUpdate
=
regexp
.
MustCompile
(
`Last update date: ([0-9:\- ]+)`
)
reArchiveDate
=
regexp
.
MustCompile
(
`Sisyphus archive date: ([0-9\-]+)`
)
)
func
deferredGetHTML
()
string
{
resp
,
err
:=
http
.
Get
(
config
.
Env
.
Repo
.
DeferredInfoURL
)
if
err
!=
nil
{
color
.
Red
(
"Ошибка получения данных"
)
os
.
Exit
(
1
)
}
defer
resp
.
Body
.
Close
()
data
,
err
:=
io
.
ReadAll
(
resp
.
Body
)
if
err
!=
nil
{
color
.
Red
(
"Ошибка получения данных"
)
os
.
Exit
(
1
)
}
return
string
(
data
)
}
func
deferredLastUpdate
(
html
string
)
string
{
if
m
:=
reLastUpdate
.
FindStringSubmatch
(
html
);
m
!=
nil
{
return
m
[
1
]
}
return
""
}
func
DeferredLastUpdateCommand
(
ctx
context
.
Context
,
cmd
*
cli
.
Command
)
error
{
html
:=
deferredGetHTML
()
lastUpdate
:=
deferredLastUpdate
(
html
)
fmt
.
Println
(
lastUpdate
)
return
nil
}
func
deferredArchiveDate
(
html
string
)
string
{
if
m
:=
reArchiveDate
.
FindStringSubmatch
(
html
);
m
!=
nil
{
return
m
[
1
]
}
return
""
}
func
DeferredArchiveDateCommand
(
ctx
context
.
Context
,
cmd
*
cli
.
Command
)
error
{
html
:=
deferredGetHTML
()
archiveDate
:=
deferredArchiveDate
(
html
)
fmt
.
Println
(
archiveDate
)
return
nil
}
func
DeferredInfoCommand
(
ctx
context
.
Context
,
cmd
*
cli
.
Command
)
error
{
html
:=
deferredGetHTML
()
lastUpdate
:=
deferredLastUpdate
(
html
)
archiveDate
:=
deferredArchiveDate
(
html
)
color
.
Green
(
"Deferred:"
)
fmt
.
Printf
(
" Последнее обновление: %s
\n
"
,
lastUpdate
)
fmt
.
Printf
(
" Дата архива: %s
\n
"
,
archiveDate
)
return
nil
}
repo/commands.go
0 → 100644
View file @
f079c7dc
package
repo
import
"github.com/urfave/cli/v3"
func
CommandList
()
*
cli
.
Command
{
return
&
cli
.
Command
{
Name
:
"repo"
,
Usage
:
"Ximper repos"
,
Commands
:
[]
*
cli
.
Command
{
{
Name
:
"deferred"
,
Usage
:
"Deferred repo"
,
Commands
:
[]
*
cli
.
Command
{
{
Name
:
"info"
,
Usage
:
"Deferred repo info"
,
Action
:
DeferredInfoCommand
,
},
{
Name
:
"date"
,
Usage
:
"Sisyphus archive date"
,
Action
:
DeferredArchiveDateCommand
,
},
{
Name
:
"last-update"
,
Usage
:
"Date of last update"
,
Action
:
DeferredLastUpdateCommand
,
},
},
},
},
}
}
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