-
Notifications
You must be signed in to change notification settings - Fork 206
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
82 additions
and
455 deletions.
There are no files selected for viewing
11 changes: 8 additions & 3 deletions
11
.../chifra/internal/config/handle_session.go → ...pps/chifra/internal/config/handle_dump.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,19 @@ | ||
package configPkg | ||
|
||
import ( | ||
"github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/config" | ||
"github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/output" | ||
"github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/types" | ||
) | ||
|
||
// HandleSession returns an empty session | ||
func (opts *ConfigOptions) HandleSession(rCtx *output.RenderCtx) error { | ||
// HandleDump dumps a config to the screen | ||
func (opts *ConfigOptions) HandleDump(rCtx *output.RenderCtx) error { | ||
fetchData := func(modelChan chan types.Modeler, errorChan chan error) { | ||
modelChan <- &types.Session{} | ||
var s types.Config | ||
s.Config = *config.GetRootConfig() | ||
modelChan <- &s | ||
} | ||
|
||
opts.Globals.NoHeader = true | ||
return output.StreamMany(rCtx, fetchData, opts.Globals.OutputOpts()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Copyright 2016, 2024 The TrueBlocks Authors. All rights reserved. | ||
// Use of this source code is governed by a license that can | ||
// be found in the LICENSE file. | ||
package types | ||
|
||
import ( | ||
"encoding/json" | ||
|
||
"github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/configtypes" | ||
) | ||
|
||
type Config struct { | ||
configtypes.Config | ||
} | ||
|
||
func (s Config) String() string { | ||
bytes, _ := json.Marshal(s) | ||
return string(bytes) | ||
} | ||
|
||
func (s *Config) Model(chain, format string, verbose bool, extraOpts map[string]any) Model { | ||
// keys := map[string]any{} | ||
// for key, value := range s.Keys { | ||
// keys[key] = value | ||
// } | ||
c := map[string]any{} | ||
for key, value := range s.Chains { | ||
c[key] = value | ||
} | ||
return Model{ | ||
Data: map[string]any{ | ||
"version": s.Version, | ||
"settings": s.Settings, | ||
"keys": s.Keys, | ||
"pinnging": s.Pinning, | ||
"unchained": s.Unchained, | ||
"chains": s.Chains, | ||
}, | ||
Order: []string{}, | ||
} | ||
} | ||
|
||
func (s *Config) FinishUnmarshal() { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.