]> gitweb.michael.orlitzky.com - mailshears.git/blobdiff - lib/common/user_interface.rb
Update comments in the executable and factor out the make_header() function.
[mailshears.git] / lib / common / user_interface.rb
diff --git a/lib/common/user_interface.rb b/lib/common/user_interface.rb
new file mode 100644 (file)
index 0000000..6a60d04
--- /dev/null
@@ -0,0 +1,19 @@
+def make_header(program_name, plugin_name)
+  # The header that we output before the list of domains/users.
+  # Just the path of this script, the current time, and the plugin name.
+  header = "#{program_name}, "
+
+  current_time = Time.now()
+  if current_time.respond_to?(:iso8601)
+    # Somehow this method is missing on some machines.
+    header += current_time.iso8601.to_s
+  else
+    # Fall back to whatever this looks like.
+    header += current_time.to_s
+  end
+
+  header += ' (Plugin: ' + plugin_name + ")\n"
+  header += '-' * header.size # Underline the header.
+
+  return header
+end