github.com/TrueBlocks/trueblocks-core/src/apps/chifra@v0.0.0-20241022031540-b362680128f7/internal/when/handle_timestamps.go (about)

     1  // Copyright 2021 The TrueBlocks Authors. All rights reserved.
     2  // Use of this source code is governed by a license that can
     3  // be found in the LICENSE file.
     4  
     5  package whenPkg
     6  
     7  import (
     8  	"github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base"
     9  	"github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/output"
    10  )
    11  
    12  // HandleTimestampsShow handles chifra when --timestamps
    13  func (opts *WhenOptions) HandleTimestamps(rCtx *output.RenderCtx) error {
    14  	var err error
    15  	if opts.Update {
    16  		err = opts.HandleTimestampsUpdate(rCtx)
    17  	} else if opts.Count {
    18  		err = opts.HandleTimestampsCount(rCtx)
    19  	} else if opts.Truncate != base.NOPOSN {
    20  		err = opts.HandleTimestampsTruncate(rCtx)
    21  	} else if opts.Check {
    22  		err = opts.HandleTimestampsCheck(rCtx)
    23  	} else if opts.Repair {
    24  		err = opts.HandleTimestampsRepair(rCtx)
    25  	} else {
    26  		err = opts.HandleTimestampsShow(rCtx)
    27  	}
    28  	return err
    29  }