cromshell icon indicating copy to clipboard operation
cromshell copied to clipboard

add a command to open a browser page for the execution bucket

Open SHuang-Broad opened this issue 3 years ago • 3 comments

SHuang-Broad avatar Mar 07 '22 20:03 SHuang-Broad

If you want a quick version of this that's portable, I wrote a function to do exactly this:

function openGsPath() 
{
  P=""
  if [[ $# -eq 0 ]] ; then
    P=$( sed -e \
        '[/^http[s]*/ {
           s#^http[s]*://console.cloud.google.com/storage/browser/#GSREP# 
           s#^http[s]*://console.cloud.google.com/#GSREP#
           s#^http[s]*://storage.cloud.google.com/#GSREP#
        }
        /^gs:\/\// {
           s#^gs://#HTTPSREP#
        }
        /^GSREP/ {
           s#^GSREP#gs://#
        }
        /^HTTPSREP/ {
           s#HTTPSREP#https://console.cloud.google.com/storage/browser/#
         }' -e 's#gs://_details/#gs://#' -e 's#?.*##' - )
  else
    P=$( echo "${1}" | sed -e \
      '/^http[s]*/ {
          s#^http[s]*://console.cloud.google.com/storage/browser/#GSREP# 
          s#^http[s]*://console.cloud.google.com/#GSREP#
          s#^http[s]*://storage.cloud.google.com/#GSREP#
       }
       /^gs:\/\// {
          s#^gs://#HTTPSREP#
       }
       /^GSREP/ {
          s#^GSREP#gs://#
       }
       /^HTTPSREP/ {
          s#HTTPSREP#https://console.cloud.google.com/storage/browser/#
        }' -e 's#gs://_details/#gs://#' -e 's#?.*##' )
  fi  

  echo $P
  open ${P}
}

Put that in a shell file and source it when you log in. Then you can do openGsPath GSURL and it'll open a browser page to that location.

jonn-smith avatar Mar 16 '22 03:03 jonn-smith

Someday when I clean up my dotfiles, I'll make them public so anyone can use this…

jonn-smith avatar Mar 16 '22 03:03 jonn-smith

I have a poor-man's solution ... What I meant was to actually have the command open up the page directly by providing the workflow/submission ID. Right now, we'd have to click-click-click to get to that "folder", or manually figure out the bucket and folder/prefix.

SHuang-Broad avatar Mar 16 '22 15:03 SHuang-Broad