[Windows CMD] Cannot write multiple values/only change one value in a file, when not writing to a temporary file first

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

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

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
領域
cli

調査の方向性

示されている initool set と get コマンドを使用し、filename.ini に対して出力をそのファイルへリダイレクトして、問題を再現します。set の CLI エントリポイントから開始し、出力が stdout に書き込まれる流れを追跡します。コマンドのリダイレクトによって元のすべてのセクションとキーが保持され、要求された値だけが変更されれば完了です。

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

説明

enhancement question

(Not a duplicate of #11.)
Do you have to pipe the output to temporary files? Does it not work to overwrite the same file?

e.g.

C:\> initool get filename.ini

[section1]
abc=xyz
[section2]
foo=bar

C:\> initool set filename.ini section1 abc zyx

[section1]
abc=zyx
[section2]
foo=bar

C:\> initool set filename.ini section1 abc zyx > filename.ini
C:\ initool get filename.ini

[section1]
abc=zyx

C:\>

In the above example, I use set to change the value of one key, and then pipe that output back to the original filepath. Although the stdout of set shows all the keys of the original file with just the one key that has changed (this is expected), when it is piped back to the filepath, it overwrites the entire file with just the modified line, deleting all other lines (this is bad).

It's not the end of the world to write the output to a temp file and back, but it's an extra step that seems like it shouldn't be necessary. I'm more concerned by the fact that the stdout from the set command doesn't get written accurately when piped to a file.

主要言語
Standard ML
スター
77
フォーク
7
PR マージ指標
30日以内にマージされた PR はありません

環境構築

  • Dockerfile または Docker Compose ファイルあり
  • プルリクエストのテンプレートなし
  • コントリビューションガイドなし

はじめの一歩

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

dbohdan/initool のほかの issue

dbohdan/initool の issue をすべて見る

似ている issue

CLI の issue をもっと見る

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

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