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

lsコマンド2|仕様と実現方法 #28

Closed
Tracked by #27
asya81 opened this issue Dec 15, 2022 · 0 comments
Closed
Tracked by #27

lsコマンド2|仕様と実現方法 #28

asya81 opened this issue Dec 15, 2022 · 0 comments

Comments

@asya81
Copy link
Owner

asya81 commented Dec 15, 2022

lsコマンド2の仕様および実現方法を確認する。

lsコマンド2の仕様

lsコマンドで-aオプションを使えるようにする。

-aオプションでできること

  • .始まりのファイル含めて、全てのファイルが表示される。
  • .(カレントディレクトリ)や..(1つ上のディレクトリ)も表示される。
    • 今回の提出物では、..は出力されなくても問題ないとのこと。

lsコマンド1からの追加の対応

  • lsコマンドで-aオプションを受け取れるようにする。
  • オプションがない場合と-aオプションが渡された場合で処理を分ける。
  • -aオプションが渡された場合は、一覧表示で.始まりのオブジェクトも表示できるようにする。

追加の対応に使えそうなライブラリやメソッド

  • コマンドラインのオプションを扱うには optparseライブラリを使う。
  • .始まりのオブジェクトを表示するためには、Dir.globの引数flagsFile::FNM_DOTMATCHを渡すと良さそう。
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

No branches or pull requests

1 participant