Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Ğ
Ğcli-v2s
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
clients
Rust
Ğcli-v2s
Commits
dfcc91f2
Commit
dfcc91f2
authored
1 month ago
by
fred
Browse files
Options
Downloads
Patches
Plain Diff
ok
parent
1f167716
No related branches found
No related tags found
1 merge request
!49
Draft: Nostr
Pipeline
#40722
passed
1 month ago
Stage: tests
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/indexer.rs
+89
-51
89 additions, 51 deletions
src/indexer.rs
src/utils.rs
+2
-0
2 additions, 0 deletions
src/utils.rs
with
91 additions
and
51 deletions
src/indexer.rs
+
89
−
51
View file @
dfcc91f2
...
@@ -191,6 +191,42 @@ pub async fn handle_command(data: Data, command: Subcommand) -> Result<(), GcliE
...
@@ -191,6 +191,42 @@ pub async fn handle_command(data: Data, command: Subcommand) -> Result<(), GcliE
let
i_latest_h
=
convert_hash_bytea
(
i_latest_block
.hash
);
let
i_latest_h
=
convert_hash_bytea
(
i_latest_block
.hash
);
let
i_latest_n
=
i_latest_block
.height
;
let
i_latest_n
=
i_latest_block
.height
;
match
data
.args.output_format
{
OutputFormat
::
Json
=>
{
let
output
=
serde_json
::
json!
({
"duniter"
:
{
"url"
:
d_url
,
"genesis_hash"
:
d_gen_hash
,
"finalized_block"
:
{
"number"
:
d_finalized_n
,
"hash"
:
d_finalized_h
.to_string
()
},
"latest_block"
:
{
"number"
:
d_latest_n
,
"hash"
:
d_latest_h
.to_string
()
}
},
"indexer"
:
{
"url"
:
i_url
,
"genesis_hash"
:
i_gen_hash
,
"finalized_block"
:
{
"number"
:
i_finalized_n
,
"hash"
:
i_finalized_h
.map
(|
h
|
h
.to_string
())
},
"latest_block"
:
{
"number"
:
i_latest_n
,
"hash"
:
i_latest_h
.to_string
()
}
},
"status"
:
{
"genesis_hash_match"
:
d_gen_hash
==
i_gen_hash
,
"finalized_block_match"
:
i_finalized_h
.map_or
(
false
,
|
h
|
h
==
d_finalized_h
),
"latest_block_match"
:
i_latest_n
==
d_latest_n
as
i64
&&
i_latest_h
==
d_latest_h
}
});
println!
(
"{}"
,
serde_json
::
to_string_pretty
(
&
output
)
.unwrap
());
},
OutputFormat
::
Human
=>
{
fn
color
(
x
:
bool
)
->
Color
{
fn
color
(
x
:
bool
)
->
Color
{
match
x
{
match
x
{
true
=>
Color
::
Green
,
true
=>
Color
::
Green
,
...
@@ -245,6 +281,8 @@ pub async fn handle_command(data: Data, command: Subcommand) -> Result<(), GcliE
...
@@ -245,6 +281,8 @@ pub async fn handle_command(data: Data, command: Subcommand) -> Result<(), GcliE
println!
(
"{table}"
);
println!
(
"{table}"
);
}
}
}
}
};
};
Ok
(())
Ok
(())
...
...
This diff is collapsed.
Click to expand it.
src/utils.rs
+
2
−
0
View file @
dfcc91f2
...
@@ -116,6 +116,8 @@ pub enum GcliError {
...
@@ -116,6 +116,8 @@ pub enum GcliError {
/// error coming from io
/// error coming from io
#[allow(dead_code)]
#[allow(dead_code)]
IoError
(
std
::
io
::
Error
),
IoError
(
std
::
io
::
Error
),
/// error coming from config
Config
(
String
),
}
}
impl
std
::
fmt
::
Display
for
GcliError
{
impl
std
::
fmt
::
Display
for
GcliError
{
fn
fmt
(
&
self
,
f
:
&
mut
std
::
fmt
::
Formatter
)
->
std
::
fmt
::
Result
{
fn
fmt
(
&
self
,
f
:
&
mut
std
::
fmt
::
Formatter
)
->
std
::
fmt
::
Result
{
...
...
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