Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
I3csstatus
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jiří Kalvoda
I3csstatus
Commits
f3b3b66f
Commit
f3b3b66f
authored
2 years ago
by
Jiří Kalvoda
Browse files
Options
Downloads
Patches
Plain Diff
Cleanup: Remove color option from all modules and parser
Please use _color instead.
parent
400b16a6
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
Module.cs
+4
-6
4 additions, 6 deletions
Module.cs
Parsers.cs
+1
-3
1 addition, 3 deletions
Parsers.cs
sample.conf
+3
-8
3 additions, 8 deletions
sample.conf
with
8 additions
and
17 deletions
Module.cs
+
4
−
6
View file @
f3b3b66f
...
@@ -110,15 +110,13 @@ interface Module
...
@@ -110,15 +110,13 @@ interface Module
class
ModuleConstant
:
Module
class
ModuleConstant
:
Module
{
{
string
text
;
string
text
;
Color
color
;
public
void
Init
(
ModuleParent
_bar
,
ConfigSection
section
)
public
void
Init
(
ModuleParent
_bar
,
ConfigSection
section
)
{
{
text
=
section
.
Mandatory
(
"text"
);
text
=
section
.
Mandatory
(
"text"
);
color
=
section
?[
"color"
]?.
AsColor
()
??
System
.
Drawing
.
ColorTranslator
.
FromHtml
(
"white"
);
}
}
public
IEnumerable
<
Block
>
Get
()
public
IEnumerable
<
Block
>
Get
()
{
{
return
new
Block
[]{
new
Block
(
text
,
Color
:
color
)};
return
new
Block
[]{
new
Block
(
text
)};
}
}
}
}
...
@@ -138,14 +136,14 @@ class ModuleFile: Module
...
@@ -138,14 +136,14 @@ class ModuleFile: Module
new
ConfigParser
(
new
ConfigParser
(
@"
@"
[constant]
[constant]
color = red
_
color = red
text = NFound
text = NFound
"
));
"
));
ifReadError
=
new
InnerStatusBar
(
_bar
,
section
.
Optional
(
"error_handler"
)?.
AsConfig
()
??
ifReadError
=
new
InnerStatusBar
(
_bar
,
section
.
Optional
(
"error_handler"
)?.
AsConfig
()
??
new
ConfigParser
(
new
ConfigParser
(
@"
@"
[constant]
[constant]
color = red
_
color = red
text = ERR
text = ERR
"
));
"
));
parser
=
_bar
.
GetGlobal
<
ParserGetter
>().
ByNameFromConfig
(
section
.
Optional
(
"parser"
));
parser
=
_bar
.
GetGlobal
<
ParserGetter
>().
ByNameFromConfig
(
section
.
Optional
(
"parser"
));
...
@@ -353,7 +351,7 @@ class ModuleHttp: ModuleSourceThreadAndParser
...
@@ -353,7 +351,7 @@ class ModuleHttp: ModuleSourceThreadAndParser
new
ConfigParser
(
new
ConfigParser
(
@"
@"
[constant]
[constant]
color = red
_
color = red
text = ERR
text = ERR
"
));
"
));
period_ms
=
section
.
Optional
(
"period"
)?.
AsMs
()
??
10000
;
period_ms
=
section
.
Optional
(
"period"
)?.
AsMs
()
??
10000
;
...
...
This diff is collapsed.
Click to expand it.
Parsers.cs
+
1
−
3
View file @
f3b3b66f
...
@@ -104,15 +104,13 @@ interface Parser
...
@@ -104,15 +104,13 @@ interface Parser
[
ParserName
(
"text"
)]
[
ParserName
(
"text"
)]
class
ParserText
:
Parser
class
ParserText
:
Parser
{
{
Color
color
;
public
void
Init
(
ModuleParent
_bar
,
Module
_module
,
ConfigSection
section
)
public
void
Init
(
ModuleParent
_bar
,
Module
_module
,
ConfigSection
section
)
{
{
color
=
section
.
Optional
(
"color"
)?.
AsColor
()
??
System
.
Drawing
.
ColorTranslator
.
FromHtml
(
"white"
);
}
}
public
IEnumerable
<
Block
>
Parse
(
string
data
)
public
IEnumerable
<
Block
>
Parse
(
string
data
)
{
{
if
(
data
.
Length
>
0
&&
data
[^
1
]
==
'\n'
)
data
=
data
[..^
1
];
if
(
data
.
Length
>
0
&&
data
[^
1
]
==
'\n'
)
data
=
data
[..^
1
];
return
data
.
Split
(
"\n"
).
Select
(
x
=>
new
Block
(
x
,
Color
:
color
)).
ToArray
();
return
data
.
Split
(
"\n"
).
Select
(
x
=>
new
Block
(
x
)).
ToArray
();
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
sample.conf
+
3
−
8
View file @
f3b3b66f
...
@@ -176,7 +176,6 @@ short_format = {percent}
...
@@ -176,7 +176,6 @@ short_format = {percent}
[
constant
]
[
constant
]
# Just show some text
# Just show some text
text
=
Hi
!
text
=
Hi
!
color
=
red
[
file
]
[
file
]
...
@@ -184,11 +183,11 @@ color = red
...
@@ -184,11 +183,11 @@ color = red
path
= $
HOME
/
file
/
to
/
show
path
= $
HOME
/
file
/
to
/
show
# mandatory <path>
# mandatory <path>
not_found_handler
= [
constant
]
not_found_handler
= [
constant
]
color
=
red
_
color
=
red
text
=
NFound
text
=
NFound
# <config> default see above
# <config> default see above
error_handler
= [
constant
]
error_handler
= [
constant
]
color
=
red
_
color
=
red
text
=
ERR
text
=
ERR
# <config> default see above
# <config> default see above
...
@@ -267,7 +266,7 @@ stdin
...
@@ -267,7 +266,7 @@ stdin
# Fetch message from http(s) (for example a JSON api).
# Fetch message from http(s) (for example a JSON api).
error_handler
= [
constant
]
error_handler
= [
constant
]
color
=
red
_
color
=
red
text
=
ERR
text
=
ERR
# See file module
# See file module
...
@@ -317,10 +316,6 @@ _default_color = red
...
@@ -317,10 +316,6 @@ _default_color = red
# Parser: text
# Parser: text
# ------------
# ------------
# Each line will be one segment of status bar.
# Each line will be one segment of status bar.
#
# Options:
# color = red
# <color>
# Parser: osdd_last
# Parser: osdd_last
# ------------
# ------------
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment