Skip to content

Commit

Permalink
@ls refactor - kamangir/bolt#746
Browse files Browse the repository at this point in the history
  • Loading branch information
kamangir committed May 6, 2024
1 parent 0da8a95 commit 5302398
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
36 changes: 18 additions & 18 deletions .abcli/list.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ function abcli_hubble_list() {
local task=$1

if [ "$task" == help ]; then
abcli_show_usage "hubble list dataset$ABCUL$EOP.|<hubble-dataset-name>$EOPE" \
"list <hubble-dataset-name>, example: hst."
abcli_show_usage "hubble list dataset$ABCUL$EOP.|<hubble-dataset-name>$ABCUL<suffix>$EOPE" \
"list <hubble-dataset-name>/<suffix>, example: hst."

local options="keyword=<keyword>"
abcli_show_usage "hubble list datasets$ABCUL$EOP$options$EOPE" \
"list hubble datasets."

abcli_show_usage "hubble list ${EOP}object$ABCUL.|<hubble-object-name>$EOPE" \
abcli_show_usage "hubble list ${EOP}object$ABCUL.|<hubble-object-name>$ABCUL<suffix>$EOPE" \
"list <hubble-object-name> in $abcli_hubble_dataset_name, example in hst: public/u4ge/u4ge0106r."
return
fi
Expand All @@ -36,39 +36,39 @@ function abcli_hubble_list() {
return 0
fi

local suffix
if [[ -z "$thing_type" ]]; then
local thing_type=object
local thing_name=$abcli_hubble_object_name
local args="${@:2}"
thing_type=object
thing_name=$abcli_hubble_object_name
suffix="${@:2}"
elif [[ $(abcli_hubble_is_dataset $thing_type) == 1 ]]; then
local thing_type=dataset
local thing_name=${1:-.}
local args="${@:2}"
thing_type=dataset
thing_name=${1:-.}
suffix="${@:2}"
elif [[ "$thing_type" != dataset ]] && [[ "$thing_type" != object ]]; then
local thing_type=object
local thing_name=${1:-.}
local args="${@:2}"
thing_type=object
thing_name=${1:-.}
suffix="${@:2}"
fi

local dataset_name=$abcli_hubble_dataset_name
[[ "$thing_type" == dataset ]] &&
local dataset_name=$(abcli_clarify_object "$thing_name" "" hubble_dataset)
dataset_name=$(abcli_clarify_object "$thing_name" "" hubble_dataset)

local object_name=""
[[ "$thing_type" == object ]] &&
local object_name=$(abcli_clarify_object "$thing_name" "" hubble_object)
object_name=$(abcli_clarify_object "$thing_name" "" hubble_object)

abcli_log "🔭 $dataset_name :: $object_name"

local s3_uri=$(abcli_hubble_get s3_uri $dataset_name $object_name)
[[ ! -z "$suffix" ]] && s3_uri=$s3_uri$suffix
abcli_log "🔗 $s3_uri"

# https://registry.opendata.aws/hst/
local command_line="aws s3 ls \
abcli_eval - \
"aws s3 ls \
$(abcli_hubble_get auth $dataset_name) \
$s3_uri \
$args"

abcli_log "⚙️ $command_line"
eval "$command_line"
}
2 changes: 1 addition & 1 deletion hubble/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

DESCRIPTION = f"{ICON} tools to access and process Hubble Space Telescope imagery and other datasets on AWS Open Data Registry."

VERSION = "3.327.1"
VERSION = "3.329.1"

0 comments on commit 5302398

Please sign in to comment.