Feature: Run and save commands In order to organize and run commonly-used commands I want to save commands in an organized fashion And to be able to invoke any saved command easily So I don't have the hassle of creating a bunch of unorganized aliases Scenario: Basic UI When I get help for "fav" Then the exit status should be 0 And the banner should be present And there should be a one line summary of what the app does And the banner should include the version And the banner should document that this app takes options And the banner should document that this app's arguments are: |command_name|which is required| Scenario: Add a Command When I run `fav -a 'man cp' mc` Then the ungrouped command "man cp" is added with name "mc" Scenario: Add a Command to a Group When I run `fav -a 'ls -l' -g TestGroup gr` Then the command "ls -l" is added with name "gr" to the group "TestGroup" Scenario: Remove an Ungrouped Command Given a file named "/tmp/home/.favs" with: """ ef = "echo Foo" eb = "echo Bar" """ When I run `fav -r ef` Then the command with name "ef" no longer exists as a fav And the ungrouped command "echo Bar" is added with name "eb" Scenario: Remove a Grouped Command Given a file named "/tmp/home/.favs" with: """ [test] ef = "echo Foo" eb = "echo Bar" """ When I run `fav -g test -r ef` Then the command with name "ef" no longer exists as a fav in the group "test" And the command "echo Bar" is added with name "eb" to the group "test" Scenario: Run a Command Given a file named "/tmp/home/.favs" with: """ cpt = "touch /tmp/home/test.txt" """ When I run `fav cpt` Then the file "test.txt" exists in "/tmp/home" Scenario: Run a Grouped Command Given a file named "/tmp/home/.favs" with: """ [test] cpt = "touch /tmp/home/test2.txt" """ When I run `fav -g test cpt` Then the file "test2.txt" exists in "/tmp/home" Scenario: Run an entire group of commands Given a file named "/tmp/home/.favs" with: """ [test] cpt2 = "touch /tmp/home/test2.txt" cpt = "touch /tmp/home/test.txt" """ When I run `fav -g test --no_prompt` Then the file "test2.txt" exists in "/tmp/home" And the file "test.txt" exists in "/tmp/home" Scenario: Run a command that prepends text to the end Given a file named "/tmp/home/.favs" with: """ e = "echo $0" """ When I run `fav e 'foo'` Then it should pass with: """ foo """ Scenario: Add a Command without a Command Name When I run `fav -a 'echo I am a command'` Then it should fail with: """ Must specify command name when adding a fav. """ Scenario: Remove a Command without a Command Name When I run `fav -r` Then it should fail with: """ Must specify command name when removing a fav. """ Scenario: Run a command for a group that doesn't exist When I run `fav -g NotAGroup cmd` Then it should fail with: """ Specified group does not exist. """ Scenario: List commands within a group Given a file named "/tmp/home/.favs" with: """ ug = "echo ungrouped" [test] ef = "echo Foo" eb = "echo Bar" """ When I run `fav -l -g test` Then it should pass with exactly: """ ef = "echo Foo" eb = "echo Bar" """ Scenario: List all commands Given a file named "/tmp/home/.favs" with: """ ug = "echo ungrouped" [test] ef = "echo Foo" eb = "echo Bar" """ When I run `fav -l` Then it should pass with exactly: """ ug = "echo ungrouped" [test] ef = "echo Foo" eb = "echo Bar" """