Permalink
Browse files

Added the --datfile option, as suggested in issue #19

  • Loading branch information...
1 parent 59acdd4 commit bfdf245dd3b0c184f14e67c3ae1c7ae3638660b4 @creaktive committed Oct 29, 2013
Showing with 22 additions and 6 deletions.
  1. +3 −0 README
  2. +5 −0 README.md
  3. +11 −4 rainbarf
  4. +3 −2 t/01-tmux.t
View
3 README
@@ -138,6 +138,9 @@ OPTIONS
disabling the battery indicator or raising the "status-right-length"
value in ~/.tmux.conf.
+ "--datfile FILENAME"
+ Specify the file to log CPU stats to. Default: $HOME/.rainbarf.dat
+
CAVEAT
Time remaining
If the "--remaining" option is present but you do not see the time in
View
@@ -165,6 +165,11 @@ Configuration file can be specified via `RAINBARF` environment variable:
Chart width. Default is 38, so both the chart and the battery indicator fit the `tmux` status line.
Higher values may require disabling the battery indicator or raising the `status-right-length` value in `~/.tmux.conf`.
+- `--datfile FILENAME`
+
+ Specify the file to log CPU stats to.
+ Default: `$HOME/.rainbarf.dat`
+
# CAVEAT
## Time remaining
View
@@ -29,8 +29,8 @@ my $screen = 0;
my $tmux = not -t \*STDOUT;
my $rgb = 0;
-my ($help, $show_battery, $remaining, $bolt, $chart_bg,
- $chart_fg, $bright, $loadavg, $swap, $threshold, $width);
+my ($help, $show_battery, $remaining, $bolt, $chart_bg, $chart_fg,
+ $bright, $loadavg, $swap, $threshold, $width, $history);
# parse the options file
my $rcname = exists($ENV{RAINBARF})
@@ -65,13 +65,12 @@ if (@ARGV) {
q(tmux!) => \$tmux,
q(rgb!) => \$rgb,
q(width=i) => \$width,
+ q(datfile=s) => \$history,
) or help(-verbose => 1);
}
defaults();
-my $history = qq($ENV{HOME}/.rainbarf.dat);
-
my $chart = eval { lock_retrieve $history };
$chart = [ (0) x $width ] unless defined $chart;
@@ -146,6 +145,9 @@ sub defaults {
$bolt = (defined $bolt and $bolt) ? chr 0x26a1 : q(|);
require Term::ANSIColor if not $tmux and not $screen;
+ $history = qq($ENV{HOME}/.rainbarf.dat)
+ unless defined $history;
+
return;
}
@@ -634,6 +636,11 @@ L<screen(1)|http://manpages.ubuntu.com/manpages/hardy/man1/screen.1.html> colors
Chart width. Default is 38, so both the chart and the battery indicator fit the C<tmux> status line.
Higher values may require disabling the battery indicator or raising the C<status-right-length> value in F<~/.tmux.conf>.
+=item C<--datfile FILENAME>
+
+Specify the file to log CPU stats to.
+Default: F<$HOME/.rainbarf.dat>
+
=back
=head1 CAVEAT
View
@@ -12,7 +12,7 @@ plan skip_all => qq(The platform $^O is unsupported)
my $tmp = File::Temp->newdir;
local $ENV{RAINBARF} = q(/dev/null);
-local $ENV{HOME} = $tmp->dirname;
+my $file = $tmp->dirname . '/rainbarf.dat';
my $n = 10;
@@ -41,7 +41,8 @@ for my $i (1 .. $n) {
--nobattery
--swap
--tmux
- ]),
+ --datfile
+ ], $file),
qq(pipe $i),
);
chomp(my $line = <$out>);

0 comments on commit bfdf245

Please sign in to comment.