Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature to reference a tag #111

Closed
dakusui opened this issue Dec 12, 2019 · 0 comments
Closed

Feature to reference a tag #111

dakusui opened this issue Dec 12, 2019 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@dakusui
Copy link
Owner

dakusui commented Dec 12, 2019

Following will achieve it.

  function refexists() {
    # shellcheck disable=SC2181
    [[ $? == 0 ]] || abort "${_error_prefix}Failure was detected."
    local _path="${1}"
    has_value_at "${_path}" "$(cat "$(self)")"
  }

  function reftag() {
    # shellcheck disable=SC2181
    [[ $? == 0 ]] || abort "${_error_prefix}Failure was detected."
    local _tagname="${1}"
    local _curpath
    _curpath="$(curn)"
    while [[ "${_curpath}" != "" ]]; do
    _curpath="$(parent "${_curpath}")"
    if refexists "${_curpath}.${_tagname}";  then
      ref "${_curpath}.${_tagname}"
      return 0
    fi
    done
    abort "${_error_prefix}The specified tag:'${_tagname}' was not found from the current path:'$(curn)'"
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant