Make 'list' output similar to that of chkconfig(8)
authorSteven McDonald <steven@steven-mcdonald.id.au>
Sat, 13 Oct 2012 07:06:26 +0000 (18:06 +1100)
committerSteven McDonald <steven@steven-mcdonald.id.au>
Sat, 13 Oct 2012 07:06:26 +0000 (18:06 +1100)
bin/aids

index 5388ea942bba7414a2768b0930a6de3a332ad31c..41556050601ab3d85bb681f7e98803b62c820b25 100755 (executable)
--- a/bin/aids
+++ b/bin/aids
@@ -23,9 +23,11 @@ def main(argv)
 end
 
 def display_status(svc)
-       print "#{svc.name[0..14]}:#{' ' * (16 - svc.name[0..14].length)}"
+       print "#{svc.name[0..14]}#{' ' * (16 - svc.name[0..14].length)}"
        status = svc.status
+       prettystatus = nil
        AIDS::RUNLEVEL_ALL.each do |r|
+               print "\t" if prettystatus
                case status[r]
                        when :start
                                prettystatus = 'on'
@@ -36,7 +38,7 @@ def display_status(svc)
                        else
                                next
                end
-                       print "#{r}: #{prettystatus + ' ' * (8 - prettystatus.length)}"
+                       print "#{r}:#{prettystatus}"
                end
        puts
 end