#!/bin/bash IFS=':' read -a args <<< "$1" path=${args[0]} line=${args[1]} main_module_repo_path=$(git rev-parse --show-superproject-working-tree 2>/dev/null) repo_path=$(git rev-parse --show-toplevel 2>/dev/null) if [[ -z "$main_module_repo_path" ]]; then main_module_repo_path=$repo_path fi main_module_relative_file_path=$main_module_repo_path/$path repo_relative_file_path=/$path relative_file_path=$path servername=/tmp/nvr$(echo $main_module_repo_path | tr "/" "_") if [ -f "$relative_file_path" ]; then nvr -s --servername $servername +$line "$relative_file_path" elif [ -f "$repo_relative_file_path" ]; then nvr -s --servername $servername +$line "$repo_relative_file_path" elif [ -f "$main_module_relative_file_path" ]; then nvr -s --servername $servername +$line "$main_module_relative_file_path" fi