diff options
-rwxr-xr-x | bin/meta-cat | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/bin/meta-cat b/bin/meta-cat index 5e7097e..381a0a3 100755 --- a/bin/meta-cat +++ b/bin/meta-cat @@ -1,7 +1,8 @@ #!/usr/bin/env ruby # Usage: meta-cat -# Copyright 2016 Luke Shumaker <lukeshu@sbcglobal.net>. +# Copyright 2016 Luke Shumaker <lukeshu@sbcglobal.net> +# Copyright 2019 bill-auger <bill-auger@programmer.net> # # This is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as @@ -17,6 +18,20 @@ # License along with this manual; if not, see # <http://www.gnu.org/licenses/>. + load "#{File.dirname(__FILE__)}/common.rb" -print load_all_users.to_yaml + +users = load_all_users + +if ARGV.size == 2 && ARGV[0] == '--group' + users.each do | user | + group = ARGV[1] + uid = user[0] + user_data = user[1] + + print "#{uid},#{user_data['username']}\n" if user_data['groups'].include? group + end +else + print users.to_yaml +end |