Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add type option to search command #104

Closed
wants to merge 3 commits into from

Conversation

MitsukiUsui
Copy link

#99

@MitsukiUsui
Copy link
Author

成功例

$ deno run -A dim.ts search "東京 避難所" -n 1
132047_東京都_三鷹市_避難所
  - Catalog URL        : https://www.geospatial.jp/ckan/dataset/132047-002
  - Catalog Description: ####避難所のデータです。 / ####東京都三鷹市のオープンデータです。【リソース】避難所(2018年6月5日更新)(CSV5KB) / ####避難所データのCSVです。 / ####更新日:2018年7月20日【キーワード】三鷹市 / 東京都 / 避難所
  - Catalog License    : CC-BY4.0
    1. 避難所(2018年6月5日更新)(CSV5KB)
      * Resource URL        : https://www.geospatial.jp/ckan/dataset/08ef40b5-082e-4eb5-9be4-317e88a0f0a8/resource/824bd25f-ba55-4908-b857-793fdea70cf5/download/hinanjyo.csv
      * Resource Description: ####避難所データのCSVです。
####更新日:2018年7月20日
      * Created             : 2018-10-30T02:31:05.931229
      * Format              : CSV
$ deno run -A dim.ts search "東京 避難所" -n 1 --type json
[
  {
    xckan_id: "www.geospatial.jp__ckan__dataset:132047-002",
    xckan_title: "132047_東京都_三鷹市_避難所",
    xckan_site_name: "G空間情報センター",
    xckan_site_url: "https://www.geospatial.jp/ckan/dataset/132047-002",
    xckan_last_updated: "2020-02-04T10:16:20Z",
$ deno run -A dim.ts search "東京 避難所" -n 1 --type text
132047_東京都_三鷹市_避難所
  - Catalog URL        : https://www.geospatial.jp/ckan/dataset/132047-002
  - Catalog Description: ####避難所のデータです。 / ####東京都三鷹市のオープンデータです。【リソース】避難所(2018年6月5日更新)(CSV5KB) / ####避難所データのCSVです。 / ####更新日:2018年7月20日【キーワード】三鷹市 / 東京都 / 避難所
  - Catalog License    : CC-BY4.0
    1. 避難所(2018年6月5日更新)(CSV5KB)
      * Resource URL        : https://www.geospatial.jp/ckan/dataset/08ef40b5-082e-4eb5-9be4-317e88a0f0a8/resource/824bd25f-ba55-4908-b857-793fdea70cf5/download/hinanjyo.csv
      * Resource Description: ####避難所データのCSVです。
####更新日:2018年7月20日
      * Created             : 2018-10-30T02:31:05.931229
      * Format              : CSV

失敗例

[mitsuki@local ~/sandbox/dim]$ deno run -A dim.ts search "東京 避難所" -n 1 --type invalid
Invalid search result type. Please select from [text|json]
$ deno run -A dim.ts search "東京 避難所" -n 1 --type json -i
You can not use 'json' type for interactive installation.

@MitsukiUsui
Copy link
Author

$ deno run -A dim.ts search -h

  Usage:   dim search <keyword>
  Version: v1.0.3  (New version available: v1.0.4. Run 'dim upgrade' to upgrade to the latest version!)

  Description:

    Search data from package_search CKAN API

  Options:

    -h, --help               - Show this help.
    -n, --number   <number>  - Specify the number of data to get by option -n (default 10).  (Default: 10)
    -i, --install            - Interactive installation.
    -t, --type     <type>    - Specify search result format [text|json].                     (Default: "text")

@codecov
Copy link

codecov bot commented Feb 28, 2023

Codecov Report

Attention: Patch coverage is 74.60317% with 16 lines in your changes missing coverage. Please review.

Project coverage is 98.84%. Comparing base (69f1d32) to head (bca49cf).
Report is 66 commits behind head on main.

Files with missing lines Patch % Lines
libs/actions.ts 27.77% 12 Missing and 1 partial ⚠️
libs/action_helper/searcher.ts 92.30% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##              main     #104      +/-   ##
===========================================
- Coverage   100.00%   98.84%   -1.16%     
===========================================
  Files           20       21       +1     
  Lines         1353     1383      +30     
  Branches       144      147       +3     
===========================================
+ Hits          1353     1367      +14     
- Misses           0       15      +15     
- Partials         0        1       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@MitsukiUsui MitsukiUsui closed this Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant