Module: cli_bdd.core.steps.file

copy_file_or_directory

Copies a file or directory.

Examples:

Given I copy a file from "/tmp/old.txt" to "/var/new.txt"
Given I copy the file named "hello.txt" to "/var/"
Given I copy a directory from "/tmp/hello/" to "/var/"

Matcher:

I copy (a|the) (?P<file_or_directory>(file|directory))( (named|from))? "(?P<source>[^"]*)" to "(?P<destination>[^"]*)"

move_file_or_directory

Moves a file or directory.

Examples:

Given I move a file from "/tmp/old.txt" to "/var/new.txt"
Given I move the file named "hello.txt" to "/var/"
Given I move a directory from "/tmp/hello/" to "/var/"

Matcher:

I move (a|the) (?P<file_or_directory>(file|directory))( (named|from))? "(?P<source>[^"]*)" to "(?P<destination>[^"]*)"

create_directory

Creates directory.

Examples:

Given a directory "/tmp/test/"
Given the directory named "/tmp/test/"

Matcher:

(a|the) directory( named)? "(?P<dir_path>[^"]*)"

change_directory

Change directory.

Examples:

Given I cd to "/tmp/test/"

Matcher:

I cd to "(?P<dir_path>[^"]*)"

create_file_with_content

Creates a file.

Examples:

Given a file "/tmp/test/" with "some content"
Given the file named "/tmp/test/" with "another content"

Matcher:

(a|the) file( named)? "(?P<file_path>[^"]*)" with "(?P<file_content>[^"]*)"

create_file_with_multiline_content

Creates a file with multiline content.

Examples:

Given a file "/tmp/test/" with:
    """
    line one
    line two
    line three
    """

Given a file named "/tmp/test/" with:
    """
    line one
    line two
    line three
    """

Matcher:

(a|the) file( named)? "(?P<file_path>[^"]*)" with

check_file_or_directory_exist

Checks whether file or directory exist.

Examples:

Then a file "/var/new.txt" should exist
Then the file named "/var/new.txt" should not exist
Then the directory "/var/" should not exist

Matcher:

(a|the) (?P<file_or_directory>(file|directory))( (named|from))? "(?P<path>[^"]*)" should( (?P<should_not>not))? exist