Skip to content

Commit

Permalink
Update install
Browse files Browse the repository at this point in the history
  • Loading branch information
ta-Hirose committed Sep 27, 2022
1 parent a2f55a1 commit bc051aa
Showing 1 changed file with 56 additions and 54 deletions.
110 changes: 56 additions & 54 deletions doc/en/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

## Overview

指定したURL、もしくは`dim.json`に記録されているURLからファイルをダウンロードする。
ダウンロードされたファイルは`data_files`配下に保存される。
Download file from specified URL or from URL recorded in `dim.json`.
Downloaded files are stored under `data_files`.

## Run dim install with URL

引数に指定されたURLからデータをダウンロードする。
Download data from URL specified in argument.

```bash
dim install [options] <URL>
Expand All @@ -17,120 +17,122 @@ dim install [options] <URL>

#### -n, --name \<name>

**必須項目**
データを識別するための一意な名前を指定する。
`update`, `uninstall`コマンドで、処理対象のデータを指定する際に使用する。
`data_files`ディレクトリ配下にデータを保存する際、サブディレクトリの名称としても使われる。
**required entry**
Specify a unique name to identify data.
Used in `update` and `uninstall` commands to specify the data to be processed.
Also used as name of a subdirectory when storing data under the `data_files` directory.

dim では -n オプションで指定された名称が、既存の名称と重複した場合、
同一データとみなしデータの再ダウンロードを制限している。
In dim, if the name specified by the -n option duplicates an existing name,
it is regarded as the same data and data re-downloading is restricted.

#### -p, --postProcesses \<process name>

**任意項目**
ダウンロードしたファイルに対する後処理を指定する。
複数指定可能
**optional entry**
Specify post-processing for downloaded files.
Multiple designations possible

| process name | description |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| unzip | ダウンロードしたzipファイルをカレントディレクトリ内に解凍する。 |
| encode \<code> | ダウンロードしたファイルの文字コードを変更する。<br>対応コード:UTF-16, UTF-16BE, UTF-16LE, UTF-8, ISO-2022-JP, Shift_JIS, EUC-JP, UNICODE |
| xlsx-to-csv | ダウンロードしたxlsxファイルをcsvファイルに変換したファイルを、data_files配下に生成する。 |
| cmd \<command> | ダウンロードしたファイルのパスを引数としてコマンドを実行する。 |
| process name | description |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| unzip | Unzip the downloaded zip file in the current directory. |
| encode \<code> | Change the character encoding of the downloaded file.<br>Corresponding code:UTF-16, UTF-16BE, UTF-16LE, UTF-8, ISO-2022-JP, Shift_JIS, EUC-JP, UNICODE |
| xlsx-to-csv | Generate downloaded xlsx files converted to csv files under the data_files distribution. |
| cmd \<command> | Execute the command with the path of the downloaded file as an argument. |

#### -H, --headers \<header>

**任意項目**
ダウンロード時のリクエストヘッダーを指定する。
複数指定可能
**optional entry**
Specify request headers for downloads.
Multiple designations possible

#### -F, --force

**任意項目**
再ダウンロードの制限を無視して、
データを強制的にダウンロードしたい場合は`-F`を指定する。
`-F`を指定して再ダウンロードすると、元のデータは上書きされる。
**optional entry**
Specify `-F` if you want to ignore the re-download restriction and force the data to be downloaded.
Re-downloading with `-F` will overwrite the original data.

### Examples

```bash
# URLを指定してダウンロードする
# Download by specifying a URL
dim install -n example https://example.com/example.zip

# ダウンロードしたzipファイルを解凍処理する。
# Unzip the downloaded zip file.
dim install -n example -p "unzip" https://example.com/example.zip

# ダウンロードしたファイルの文字コードをShift_JISに変更する。
# Change the character encoding of the downloaded file to Shift_JIS.
dim install -n example -p "encode Shift_JIS" https://example.com/example.txt

# ダウンロードしたxlsxファイルをcsvファイルに変換する。
# Convert downloaded xlsx files to csv files.
dim install -n example -p "xlsx-to-csv" https://example.com/example.xlsx

# ファイルをダウンロード後に、独自のpythonプログラムを実行する。
# After downloading the file, run your own python program.
dim install -n example -p "cmd python ./tests/test_custom_command.py" https://example.com/example.xlsx

# ダウンロードしたファイルの文字コードをUTF-8に変換した後に独自のPythonプログラムを用いて検索を行う。
# After converting the character encoding of the downloaded file to UTF-8,
# the search is performed using a proprietary Python program.
dim install -n example -p "encode UTF-8" -p "cmd search.py" https://example.com/example.txt

# ヘッダーを指定してダウンロードする。
# Download by specifying the header.
dim install -n example -H "Authorization: 1234567890abc" -H "Fiware-Service: example" https://example.com/example.txt

# 再ダウンロードを行いファイルを上書きする。
# Re-download and overwrite the file.
dim install -n example -F https://example.com/example.txt

# オプションの複数組み合わせ例。
# Example of multiple combinations of options.
dim install -n example -p "unzip" -H "Authorization: 1234567890abc" -F https://example.com/example.zip
```

## Run dim install without URL

`dim.json`に記録されているURLからファイルのダウンロードを行う。
`-f`を指定していない場合は、カレントディレクトリに存在する`dim.json`を参照する。
Download file from URL recorded in `dim.json`.
If `-f` is not specified, it refers to `dim.json` in the current directory.

```bash
dim install [options]
```

### Option
### Options

#### -f, --file \<path or URL>

**任意項目**
指定したdim.jsonの内容を元にダウンロードを行う。
ローカルファイルを指定する場合は`path`を指定する。
インターネット上のファイルを指定する場合は`URL`を指定する。
**optional entry**
Download based on the contents of the specified dim.json.
Specify `path` to specify a local file.
Specify `URL` to specify a file on the Internet.

#### -A, asyncInstall

**任意項目**
複数ファイルをダウンロードする場合、デフォルトでは同期処理でダウンロードを行う。
`-A`を指定することで非同期処理に変更される。
**optional entry**
When downloading multiple files, the default download is a synchronous process.
`-A` to change to an asynchronous process.

#### -F, --force

**任意項目**
デフォルトでは、dim.jsonとdim-lock.jsonを比較し、dim.jsonにのみ存在するデータのダウンロードを行う。
dim.json に含まれる全てのデータを強制的にダウンロードしたい場合は`-F`を指定する。
この場合、名称が一致するインストール済みのデータは上書きされる。
**optional entry**
By default, dim.json and dim-lock.json are compared and the data present only in dim.json is downloaded.
Specify `-F` if you want to force downloading of all data contained in dim.json.
In this case, installed data with matching names are overwritten.

### Examples

```bash
# カレントディレクトリの dim.jsonとdim-lock.jsonを比較し、dim.jsonにのみ存在するデータのダウンロードする。
# Compare dim.json and dim-lock.json in the current directory.
# Download the data that exists only in dim.json.
dim install

# ローカルの dim.json を指定してダウンロードする。
# Specify local dim.json to download.
dim install -f example/dim.json

# インターネット上の dim.json 指定してダウンロードする。
# dim.json on the Internet Specify and download.
dim install -f https://example.com/dim.json

# dim.json dim-lock.json の内容を元に、非同期処理でダウンロードする。
# Download asynchronously based on the contents of dim.json and dim-lock.json.
dim install -A

# 外部の dim.json を指定し、非同期処理でダウンロードする。
# Specify an external dim.json and download it in an asynchronous process.

dim install -f https://example.com/dim.json -A

# dim.json に含まれる全てのデータを強制的にダウンロードする 。
# Force download of all data contained in dim.json.
dim install -F
```

0 comments on commit bc051aa

Please sign in to comment.