add an HTTP API
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 42/100
調査の方向性
既存の /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 を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
idank/explainshell のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
idank/explainshell#367 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 65/100
idank/explainshell#368 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 65/100
idank/explainshell#365 · コメント 2 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
idank/explainshell#354 · コメント 2 件 · リアクション 4 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
idank/explainshell#343 ·
idank/explainshell の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜2日 初心者へのやさしさ 70/100
-
FingerprintSplitter raises ZeroDivisionError when int(frac_train * len(dataset)) floors to zeroオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 7 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
lmstudio-ai/mlx-engine#376 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
pyiron/bagofholding#166 ·