Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nucleo
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Miguel Montes
nucleo
Commits
01d486b5
Commit
01d486b5
authored
6 years ago
by
Robert Martin-Legene
Browse files
Options
Downloads
Patches
Plain Diff
mas colores
parent
12b11101
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bin/sealerwatch.pl
+36
-10
36 additions, 10 deletions
bin/sealerwatch.pl
with
36 additions
and
10 deletions
bin/sealerwatch.pl
+
36
−
10
View file @
01d486b5
...
...
@@ -193,6 +193,12 @@ sub number
return
hex
(
$_
[
0
]
->
result
->
{'
number
'}
);
}
sub
difficulty
{
return
if
not
exists
$_
[
0
]
->
result
->
{'
difficulty
'};
return
hex
(
$_
[
0
]
->
result
->
{'
difficulty
'}
);
}
sub
td
{
return
if
not
exists
$_
[
0
]
->
result
->
{'
totalDifficulty
'};
...
...
@@ -339,25 +345,41 @@ sub determine_colour
if
$diff
==
0
;
return
ansi::
green
()
if
$diff
<
scalar
(
keys
%signers
);
return
ansi::
bgyellow
()
.
ansi::
black
return
ansi::
bgyellow
()
.
ansi::
black
()
if
$diff
<
720
;
# one hour
return
ansi::
red
();
}
sub
colour_split
{
my
(
$name
,
$diff
,
$col
)
=
@_
;
my
(
$name
,
$diff
,
$col
,
$difficulty
)
=
@_
;
return
$name
if
$diff
==
0
;
my
$len
=
length
$name
;
return
substr
(
$name
,
0
,
$len
-
$diff
)
.
((
$col
eq
''
)
?
ansi::
green
()
:
$col
)
.
substr
(
$name
,
$len
-
$diff
)
.
ansi::
normal
()
if
$diff
<=
$len
;
if
(
$diff
<=
$len
)
{
my
$part1
=
substr
$name
,
0
,
$len
-
$diff
;
my
$part2
=
substr
$name
,
$len
-
$diff
,
1
;
my
$part3
=
substr
$name
,
$len
-
$diff
+
1
;
if
(
$difficulty
==
2
)
{
$part3
=
$part2
.
$part3
;
$part2
=
'';
}
$part2
=
ansi::
bgyellow
()
.
ansi::
black
()
.
$part2
.
ansi::
normal
()
if
$part2
ne
'';
return
$part1
.
$part2
.
((
$col
eq
''
)
?
ansi::
green
()
:
$col
)
.
$part3
.
ansi::
normal
();
}
# diff > len
return
$col
.
$name
.
ansi::
normal
();
return
ansi::
red
()
.
substr
(
$name
,
0
,
1
)
.
ansi::
normal
()
.
$col
.
substr
(
$name
,
1
)
.
ansi::
normal
();
}
sub
presentation_top
...
...
@@ -436,7 +458,10 @@ while ( defined $block || sleep 1 )
my
$lastnum
=
exists
$signers
{
$this
}
?
$signers
{
$this
}
:
-
12345
;
my
$diff
=
$number
-
$lastnum
;
my
$col
=
determine_colour
(
$diff
);
my
$id
=
colour_split
(
$this
,
$diff
,
$col
);
my
$difficulty
=
(
exists
$signers
{
$this
}
and
exists
$cache
{
$signers
{
$this
}}{'
block
'}
)
?
$cache
{
$signers
{
$this
}}{'
block
'}
->
difficulty
:
0
;
my
$id
=
colour_split
(
$this
,
$diff
,
$col
,
$difficulty
);
my
$flags
=
$diff
==
0
?
'
*
'
:
'';
my
$alias
=
alias::
translate
(
$this
);
my
$numtxt
=
(
not
defined
$lastnum
or
$lastnum
<
0
)
?
'
n/a
'
:
$lastnum
;
...
...
@@ -448,4 +473,5 @@ while ( defined $block || sleep 1 )
print
ansi::
ED
(
0
);
#
$number
=
$block
->
number
+
1
;
select
(
undef
,
undef
,
undef
,
0.2
);
}
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