#compdef RunOnTarget

# Copyright (C)Nintendo All rights reserved.
#
# These coded instructions, statements, and computer programs contain proprietary
# information of Nintendo and/or its licensed developers and are protected by
# national and international copyright laws. They may not be disclosed to third
# parties or copied or duplicated in any form, in whole or in part, without the
# prior written consent of Nintendo.
#
# The content herein is highly confidential and should be handled accordingly.

function _RunOnTarget_targets() {
    _values 'targets' 'TargetId01'
}

function _RunOnTarget_files_nca() {
  _files -g '*.nca'
}

function _RunOnTarget() {
  flags=(
    '(-t --target)'{-t,--target}'[Set target name to run the program.]:targets:_RunOnTarget_targets'
    '--suppress-auto-kill[Suppress kill all process when start up.]'
    '--no-wait[Without waiting program exit.]'
    '--success-timeout[Set timeout as success.]:timeout'
    '--failure-timeout[Set timeout as failure.]:timeout'
    '--pattern-success-exit[Set exit pattern(regex) as success.]:pattern'
    '--pattern-failure-exit[Set exit pattern(regex) as failure.]:pattern'
    '--pattern-reset-success-timeout[Set pattern(regex) to reset success timeout.]:timeout'
    '--pattern-reset-failure-timeout[Set pattern(regex) to reset failure timeout.]:timeout'
    '--reset[Reset target before run.]'
    '(-h --help)'{-h,--help}'[Show help.]'
    '(-v --verbose)'{-v,--vervose}'[Output trace logs.]'
  )

  _arguments ${flags} '*:nca(nintendo contents archive format):_files -g \*.nca'
}

_RunOnTarget

