func (c Countdown) Run(args []string) int {
	// Initialize countdown
	input := args[0]
	duration, err := time.ParseDuration(input)
	if err != nil {
		fmt.Fprintf(out, "Failed to parse input: %v", err)
		return command.RESULT_INVALID_ARG
	}
	interval, err := time.ParseDuration("10ms")
	if err != nil {
		fmt.Fprintf(out, "Failed to parse interval: %v", err)
		return command.RESULT_INTERNAL_ERROR
	}

	fmt.Fprintf(out, "Counting down %v\n", duration)

	runCountdown(duration, interval)
	return command.RESULT_SUCCESS
}
// Run sets up the countdown and starts it.
Run sets up the countdown and starts it.
// Run sets up the countdown and starts it .
func (c Countdown) Run(args []string) int {
	input := args[0]
	duration, err := time.ParseDuration(input)
	if err != nil {
		fmt.Fprintf(out, "Failed to parse input: %v", err)
		return command.RESULT_INVALID_ARG
	}
	interval, err := time.ParseDuration("10ms")
	if err != nil {
		fmt.Fprintf(out, "Failed to parse interval: %v", err)
		return command.RESULT_INTERNAL_ERROR
	}
	fmt.Fprintf(out, "Counting down %v\n", duration)
	runCountdown(duration, interval)
	return command.RESULT_SUCCESS
}
func ( c Countdown ) Run ( args [ ] string ) int { input := args [ 0 ] duration , err := time . ParseDuration ( input ) if err != nil { fmt . Fprintf ( out , " " , err ) return command . RESULT_INVALID_ARG } interval , err := time . ParseDuration ( " " ) if err != nil { fmt . Fprintf ( out , " " , err ) return command . RESULT_INTERNAL_ERROR } fmt . Fprintf ( out , " \n " , duration ) runCountdown ( duration , interval ) return command . RESULT_SUCCESS }
Run sets up the countdown and starts it.
Run sets up the countdown and starts it .
// Initialize countdown