Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions course-definition.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,11 @@ extensions:
Redirection allows you to redirect the output of a command to a file or another command.

- slug: "completions"
name: "Autocompletion"
name: "Command Completion"
description_markdown: |
In this challenge extension, you'll add programmable completion support to your shell.
In this challenge extension, you'll add command completion support to your shell.

Programmable completion allows you to autocomplete commands and executable files.
Command completion allows you to autocomplete commands and executable files.

- slug: "filename-completion"
name: "Filename Completion"
Expand Down Expand Up @@ -382,7 +382,7 @@ stages:
- slug: "lc6"
primary_extension_slug: "filename-completion"
name: "Directory completion"
difficulty: medium
difficulty: easy
marketing_md: |-
In this stage, you'll add support for completing directory names.

Expand All @@ -396,7 +396,7 @@ stages:
- slug: "no5"
primary_extension_slug: "filename-completion"
name: "Multiple matches"
difficulty: medium
difficulty: hard
marketing_md: |-
In this stage, you'll add support for handling filename completion in case of multiple matches.

Expand Down
32 changes: 29 additions & 3 deletions stage_descriptions/filename-completion-01-zv2.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ When the user presses `<TAB>` while typing an argument:
2. Find files whose names start with the typed prefix.
3. Complete the filename and add a trailing space.

The argument completion does not depend on the command.

For example,

```bash
Expand Down Expand Up @@ -44,8 +46,32 @@ The tester will verify that:

### Notes

- In this stage, you'll only need to match the prefix against the entry in the current working directory. We'll get to implementing completion in case of nested directories in the later stages.
- In this stage, you may only match the prefix against entries in the current working directory and handle only a single matching filename. We'll get to supporting nested directories and multiple matches in the later stages.

{{#lang_is_rust}}
- We recommend using a library like [rustyline](https://crates.io/crates/rustyline/) for your implementation. Most modern shells and REPLs (like the Python REPL) use [GNU readline](https://www.wikiwand.com/en/articles/GNU_Readline) under the hood. While you may need to override some of its default behaviors, it's typically less work than starting from scratch.
{{/lang_is_rust}}

{{#lang_is_python}}
- We recommend using the module [readline](https://docs.python.org/3/library/readline.html) for your implementation. Most modern shells and REPLs (like the Python REPL) use [GNU readline](https://www.wikiwand.com/en/articles/GNU_Readline) under the hood. While you may need to override some of its default behaviors, it's typically less work than starting from scratch.
{{/lang_is_python}}

{{#lang_is_go}}
- We recommend using a library like [readline](https://pkg.go.dev/github.com/chzyer/readline) for your implementation. Most modern shells and REPLs (like the Python REPL) use [GNU readline](https://www.wikiwand.com/en/articles/GNU_Readline) under the hood. While you may need to override some of its default behaviors, it's typically less work than starting from scratch.
{{/lang_is_go}}

{{#lang_is_java}}
- We recommend using a library like [JLine](https://github.com/jline/jline3) for your implementation. Most modern shells and REPLs (like the Python REPL) use [GNU readline](https://www.wikiwand.com/en/articles/GNU_Readline) under the hood. While you may need to override some of its default behaviors, it's typically less work than starting from scratch.
{{/lang_is_java}}

- In this stage, you'll only need to handle cases of single matching filename, we'll get to implementing completion in cases of directories, and multiple completions in the later stages.
{{^lang_is_rust}}
{{^lang_is_python}}
{{^lang_is_go}}
{{^lang_is_java}}
- We recommend using a library like [readline](https://en.wikipedia.org/wiki/GNU_Readline) for your implementation. Most modern shells and REPLs (like the Python REPL) use readline under the hood. While you may need to override some of its default behaviors, it's typically less work than starting from scratch.
{{/lang_is_java}}
{{/lang_is_go}}
{{/lang_is_python}}
{{/lang_is_rust}}

- The argument completion does not depend on the command.
- Different shells handle autocompletion differently. For consistency, we recommend using [Bash](https://www.gnu.org/software/bash/) for development and testing.
Loading