package solutions.tretter.githugandroid /** * Port of the upstream ruby-githug `rm_cached` level. * * Setup documents the repository shape the learner explores. Evaluation is kept * state-based whenever the exercise changes repository objects; answer-only * levels intentionally validate the answer entered at the prompt. */ internal fun rmCachedLevel(): Level = level( id = "rm_cached", title = "Rm Cached", description = "A file has accidentally been added to your staging area. Identify and remove it from the staging area. *NOTE* Do not remove the file from the file system, only from git.", hints = listOf("You may need to use more than one command to complete this."), commandSuggestions = listOf("git status", "git rm --cached deleteme.rb"), setup = { RepoState(initialized = true, files = listOf(GitFile("deleteme.rb", staged = true), GitFile(".gitignore", staged = true)), branches = mapOf("master" to 0)) }, validator = repoPredicate { repo -> repo.files.any { it.name == "deleteme.rb" && !it.staged && !it.tracked && !it.deleted } }, testCases = listOf( levelTestCase("rm cached", "git rm --cached deleteme.rb"), levelTestCase("reset staged path", "git reset deleteme.rb"), ), )