Skip to content

Commit

Permalink
ARLAS Command line 0.1.15
Browse files Browse the repository at this point in the history
  • Loading branch information
sylvaingaudan committed Feb 6, 2024
1 parent 4747f52 commit 0574434
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 33 deletions.
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ ARLAS Command Line is for managing collections and indices.
pip install arlas_cli
```

In a new terminal, you should be able to see the version:
In a new terminal, you should be able to run it:
```shell
arlas_cli
arlas_cli --help
```

### Initial configuration
Expand Down Expand Up @@ -59,7 +59,7 @@ curl -X GET https://raw.githubusercontent.com/gisaia/arlas-cli/master/tests/samp

Now we can generate the mapping file based on that sample:
```shell
arlas_cli local indices \
arlas_cli --config local indices \
mapping sample.json \
--field-mapping track.timestamps.center:date-epoch_second \
--field-mapping track.timestamps.start:date-epoch_second \
Expand All @@ -76,14 +76,14 @@ Note that the three timestamps are not identified as datetimes by `arlas_cli`. T
To add a specific mapping, it is possible to use the `create`` command:

```shell
arlas_cli local indices \
arlas_cli --config local indices \
create courses \
--mapping mapping.json
```

### List indices
```shell
arlas_cli local indices list
arlas_cli --config local indices list
```

returns:
Expand All @@ -99,14 +99,14 @@ returns:

### Add data
```shell
arlas_cli local indices \
arlas_cli --config local indices \
data courses sample.json
```

### Describe an index

```shell
arlas_cli local indices describe courses
arlas_cli --config local indices describe courses
```

returns:
Expand All @@ -128,7 +128,7 @@ returns:

### Add a collection
```shell
arlas_cli local collections \
arlas_cli --config local collections \
create courses \
--index courses --display-name courses \
--id-path track.id \
Expand All @@ -140,7 +140,7 @@ arlas_cli local collections \

### List collections
```shell
arlas_cli local collections list
arlas_cli --config local collections list
```

returns:
Expand All @@ -156,7 +156,7 @@ returns:
### Describe a collection

```shell
arlas_cli local collections describe courses
arlas_cli --config local collections describe courses
```

returns:
Expand All @@ -179,12 +179,12 @@ returns:

### Delete a collection
```shell
arlas_cli local collections delete courses
arlas_cli --config local collections delete courses
```

### Delete an index
```shell
arlas_cli local indices delete courses
arlas_cli --config local indices delete courses
```

Note: by default, it is not allowed to delete an index for a given configuration. To allow deleting, edit the configuration file and set `allow_delete` to `True`.
Expand Down
6 changes: 3 additions & 3 deletions arlas/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
from arlas.cli.variables import variables, configuration_file
from arlas.cli.settings import ARLAS, Configuration, Resource, Settings

app = typer.Typer()
app = typer.Typer(add_completion=False)
arlas_cli_version = "arlas_cli_versions"


@app.callback()
def collections_callback(
arlas_configuration: str = typer.Argument(help="Name of the ARLAS configuration to use from your configuration file ({}).".format(configuration_file))
config: str = typer.Option(help="Name of the ARLAS configuration to use from your configuration file ({}).".format(configuration_file))
):
variables["arlas"] = arlas_configuration
variables["arlas"] = config


def main():
Expand Down
8 changes: 4 additions & 4 deletions scripts/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ echo "" >> README.md
echo "Actions on collections:" >> README.md
echo "" >> README.md
echo "\`\`\`" >> README.md
echo "python3 -m arlas.cli.cli demo collections --help" >> README.md
python3 -m arlas.cli.cli demo collections --help >> README.md
echo "python3 -m arlas.cli.cli --config demo collections --help" >> README.md
python3 -m arlas.cli.cli --config demo collections --help >> README.md
echo "\`\`\`" >> README.md
echo "" >> README.md
echo "Actions on indices:" >> README.md
echo "" >> README.md
echo "\`\`\`" >> README.md
echo "python3 -m arlas.cli.cli demo indices --help" >> README.md
python3 -m arlas.cli.cli demo indices --help >> README.md
echo "python3 -m arlas.cli.cli --config demo indices --help" >> README.md
python3 -m arlas.cli.cli --config demo indices --help >> README.md
echo "\`\`\`" >> README.md


Expand Down
2 changes: 1 addition & 1 deletion scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ echo "Build and releas the image with version ${VERSION}"

# CONFIG FILE
rm $HOME/.arlas/cli/configuration.yaml
python3 -m arlas.cli.cli
python3 -m arlas.cli.cli --config local indices list
cp $HOME/.arlas/cli/configuration.yaml .
git add configuration.yaml

Expand Down
26 changes: 13 additions & 13 deletions scripts/tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ fi

# ----------------------------------------------------------
echo "TEST infer mapping and add mapping on ES"
python3 -m arlas.cli.cli local indices mapping tests/sample.json --field-mapping track.timestamps.center:date-epoch_second --field-mapping track.timestamps.start:date-epoch_second --field-mapping track.timestamps.end:date-epoch_second --push-on courses
python3 -m arlas.cli.cli --config local indices mapping tests/sample.json --field-mapping track.timestamps.center:date-epoch_second --field-mapping track.timestamps.start:date-epoch_second --field-mapping track.timestamps.end:date-epoch_second --push-on courses
if [ "$? -eq 0" ] ; then
echo "OK: Mapping infered and added"
else
Expand All @@ -27,7 +27,7 @@ fi

# ----------------------------------------------------------
echo "TEST retrieve mapping from ES"
if python3 -m arlas.cli.cli local indices list | grep courses ; then
if python3 -m arlas.cli.cli --config local indices list | grep courses ; then
echo "OK: mapping found"
else
echo "ERROR: mapping not found"
Expand All @@ -36,7 +36,7 @@ fi

# ----------------------------------------------------------
echo "TEST describe mapping from ES"
if python3 -m arlas.cli.cli local indices describe courses | grep "track.timestamps.center" | grep "date "; then
if python3 -m arlas.cli.cli --config local indices describe courses | grep "track.timestamps.center" | grep "date "; then
echo "OK: describe mapping ok"
else
echo "ERROR: describe mapping failled"
Expand All @@ -45,7 +45,7 @@ fi

# ----------------------------------------------------------
echo "TEST add data to ES"
python3 -m arlas.cli.cli local indices data courses tests/sample.json
python3 -m arlas.cli.cli --config local indices data courses tests/sample.json
if [ "$? -eq 0" ] ; then
echo "OK: data added"
else
Expand All @@ -56,7 +56,7 @@ sleep 2

# ----------------------------------------------------------
echo "TEST retrieve hits from ES"
if python3 -m arlas.cli.cli local indices list | grep courses | grep " 2 "; then
if python3 -m arlas.cli.cli --config local indices list | grep courses | grep " 2 "; then
echo "OK: two hits found"
else
echo "ERROR: hits not found"
Expand All @@ -66,7 +66,7 @@ fi

# ----------------------------------------------------------
echo "TEST add collection"
python3 -m arlas.cli.cli local collections create courses --index courses --display-name courses --id-path track.id --centroid-path track.location --geometry-path track.trail --date-path track.timestamps.center
python3 -m arlas.cli.cli --config local collections create courses --index courses --display-name courses --id-path track.id --centroid-path track.location --geometry-path track.trail --date-path track.timestamps.center
if [ "$? -eq 0" ] ; then
echo "OK: data added"
else
Expand All @@ -77,7 +77,7 @@ sleep 2

# ----------------------------------------------------------
echo "TEST retrieve collection"
if python3 -m arlas.cli.cli local collections list | grep courses ; then
if python3 -m arlas.cli.cli --config local collections list | grep courses ; then
echo "OK: collection found"
else
echo "ERROR: collection not found"
Expand All @@ -86,7 +86,7 @@ fi

# ----------------------------------------------------------
echo "TEST describe collection"
python3 -m arlas.cli.cli local collections describe courses
python3 -m arlas.cli.cli --config local collections describe courses
if [ "$? -eq 0" ] ; then
echo "OK: Describe collection ok"
else
Expand All @@ -96,7 +96,7 @@ fi

# ----------------------------------------------------------
echo "TEST count collection"
python3 -m arlas.cli.cli local collections count courses
python3 -m arlas.cli.cli --config local collections count courses
if [ "$? -eq 0" ] ; then
echo "OK: Count collection ok"
else
Expand All @@ -107,7 +107,7 @@ fi

# ----------------------------------------------------------
echo "TEST delete collection"
yes | python3 -m arlas.cli.cli local collections delete courses
yes | python3 -m arlas.cli.cli --config local collections delete courses
if [ "$? -eq 0" ] ; then
echo "OK: delete collection ok"
else
Expand All @@ -118,7 +118,7 @@ fi
sleep 2
# ----------------------------------------------------------
echo "TEST collection deleted"
if python3 -m arlas.cli.cli local collections list | grep courses ; then
if python3 -m arlas.cli.cli --config local collections list | grep courses ; then
echo "ERROR: collection found, not deleted"
exit 1
else
Expand All @@ -127,7 +127,7 @@ fi

# ----------------------------------------------------------
echo "TEST delete index"
yes | python3 -m arlas.cli.cli local indices delete courses
yes | python3 -m arlas.cli.cli --config local indices delete courses
if [ "$? -eq 0" ] ; then
echo "OK: delete index ok"
else
Expand All @@ -140,7 +140,7 @@ sleep 2

# ----------------------------------------------------------
echo "TEST index deleted"
if python3 -m arlas.cli.cli local indices list | grep courses ; then
if python3 -m arlas.cli.cli --config local indices list | grep courses ; then
echo "ERROR: index found, not deleted"
exit 1
else
Expand Down

0 comments on commit 0574434

Please sign in to comment.