Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

add an HTTP API

オープン
#60 コメント 12 件 リアクション 2 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
42/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
静か
技術スタック
python
領域
api, backend

調査の方向性

既存の /explain エンドポイントを追跡し、コマンドをどのように解析してヘルプの一致結果を生成するかを確認することから始めます。提案されている help、cmd、matches フィールドを使用して GET /api/explain?cmd=... のレスポンスを定義します。これには、重複したヘルプテキストや、Unicode の処理などのコマンドの変更も含まれます。echo -n の例に対してドキュメント化された JSON を返す HTTP エンドポイントが実装され、適切な統合テストでその動作がカバーされれば完了です。

索引モデルが issue の本文から書いたものです。

説明

It might be time to add an HTTP API for tools/websites that want to integrate with explainshell (issue #4 is one).

My current thought is to add a GET endpoint at /api/explain with a cmd parameter, similar to /explain. The response could be a JSON that looks something like this:

{
  'help' : ['help text 0', 'help text 1', ..],
  'cmd' : <parsed command>
  'matches' : [{'startindex' : x,
                    'endindex' : y,
                    'helpindex' : <index into help array, or -1 if unknown>], [..]]
}

The rationale for not inlining the help text into matches is that there can be duplicates. The reason for including cmd in the response is that it's possible for explainshell to change it, e.g. due to unicode which is not supported yet.

Example:

GET /api/explain?cmd=echo -n

{
  'help' : ['display a line of text',
             '-n     do not output the trailing newline'],
  'cmd' : 'echo -n'
  'matches' : [{'startindex' : 0, 'endindex' : 4, 'helpindex' : 0},
                   {'startindex' : 5, 'endindex' : 7, 'helpindex' : 1}]
}
主要言語
Python
スター
14.3k
フォーク
851
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

idank/explainshell のほかの issue

idank/explainshell の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。