loki v1.2.2 Loki.FileManipulation

Helpers for content manipulation injecting, appending, and other.

Summary

Functions

append_to_file(any)
append_to_file(any) :: none
append_to_file(path, content)
append_to_file(Path.t, String.t) :: :ok | {:error, Atom.t}

Helper appends lines to file.

append_to_file(path, content, opts)
append_to_file(Path.t, String.t, Keyword.t) ::
  :ok |
  {:error, Atom.t}
comment_in_file(any)
comment_in_file(any) :: none
comment_in_file(path, content)
comment_in_file(Path.t, String.t) :: :ok | {:error, Atom.t}

Helper comments line in file.

comment_in_file(path, content, opts)
comment_in_file(Path.t, String.t, Keyword.t) ::
  :ok |
  {:error, Atom.t}
inject_into_file(any)
inject_into_file(any) :: none
inject_into_file(path, injection, order, ancor)
inject_into_file(Path.t, String.t, Atom.t, String.t) ::
  :ok |
  {:error, Atom.t}

Helper injecting lines to file with before and after options.

inject_into_file(path, injection, order, ancor, opts)
inject_into_file(Path.t, String.t, Atom.t, String.t, Keyword.t) ::
  :ok |
  {:error, Atom.t}
prepend_to_file(any)
prepend_to_file(any) :: none
prepend_to_file(path, content)
prepend_to_file(Path.t, String.t) :: :ok | {:error, Atom.t}

Helper prepends lines to file.

prepend_to_file(path, content, opts)
prepend_to_file(Path.t, String.t, Keyword.t) ::
  :ok |
  {:error, Atom.t}
remove_comments_in_file(path)
remove_comments_in_file(Path.t) :: none
remove_comments_in_file(any) :: none

Helper removes all commented lines.

remove_comments_in_file(path, opts)
remove_comments_in_file(Path.t, Keyword.t) :: none
remove_from_file(any)
remove_from_file(any) :: none
remove_from_file(path, content)
remove_from_file(Path.t, String.t) :: :ok | {:error, Atom.t}

Helper removes lines from file.

remove_from_file(path, content, opts)
remove_from_file(Path.t, String.t, Keyword.t) ::
  :ok |
  {:error, Atom.t}
replace_in_file(any)
replace_in_file(any) :: none
replace_in_file(path, content, remove)
replace_in_file(String.t, String.t, String.t) ::
  :ok |
  {:error, Atom.t}

Helper replaces lines in file.

replace_in_file(path, content, remove, opts)
replace_in_file(String.t, String.t, String.t, Keyword.t) ::
  :ok |
  {:error, Atom.t}
uncomment_in_file(any)
uncomment_in_file(any) :: none
uncomment_in_file(path, content)
uncomment_in_file(Path.t, String.t) :: :ok | {:error, Atom.t}

Helper uncomments lines in file.

uncomment_in_file(path, content, opts)
uncomment_in_file(Path.t, String.t, Keyword.t) ::
  :ok |
  {:error, Atom.t}