From 7b5be3d60788a716ac65f32e7e61fc6fc2ad9b56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Murat=20Kemal=20BAYG=C3=9CN?= Date: Mon, 22 Jul 2013 11:55:46 +0300 Subject: [PATCH] #10 add output file name as optional parameter --- bin/katip | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/bin/katip b/bin/katip index 9f4c9ed..f150f4b 100755 --- a/bin/katip +++ b/bin/katip @@ -1,8 +1,12 @@ #!/usr/bin/env ruby -DEFAULT_FILE='CHANGELOG.md' +file_name='CHANGELOG.md' -def write_file(output, file_name=DEFAULT_FILE) +if ARGV.length > 0 + file_name=ARGV[0] +end + +def write_file(output, file_name) begin file = File.open(file_name, 'w') file.puts output @@ -46,6 +50,6 @@ def parse_change_log output end -write_file parse_change_log +write_file parse_change_log, file_name