Skip to content

Commit

Permalink
refactor: consolidate command flags and remove duplicate function def…
Browse files Browse the repository at this point in the history
…inition

- Add `startFlag` and `endFlag` flags to the `scanCmd` command
- Remove duplicate `init()` function definition

Signed-off-by: Sean Zheng <[email protected]>
  • Loading branch information
blackhorseya committed Jul 27, 2024
1 parent e01bfa9 commit 2da9588
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions cmd/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@ var scanCmd = &cobra.Command{
},
}

func init() {
rootCmd.AddCommand(scanCmd)
scanCmd.Flags().Uint32Var(&startFlag, "start", 0, "The start block number")
scanCmd.Flags().Uint32Var(&endFlag, "end", 0, "The end block number")
}

func getNotSeenShards(
ctx context.Context,
api ton.APIClientWrapped,
Expand Down Expand Up @@ -156,12 +162,6 @@ func getNotSeenShards(
return ret, nil
}

func init() {
rootCmd.AddCommand(scanCmd)
scanCmd.Flags().Uint32Var(&startFlag, "start", 0, "The start block number")
scanCmd.Flags().Uint32Var(&endFlag, "end", 0, "The end block number")
}

func getShardID(shard *ton.BlockIDExt) string {
return fmt.Sprintf("%d|%d", shard.Workchain, shard.Shard)
}

0 comments on commit 2da9588

Please sign in to comment.