From 18ab2b7056b47172d1ca196da4f36335349ac072 Mon Sep 17 00:00:00 2001 From: Packit Date: Sep 16 2020 18:50:49 +0000 Subject: Apply patch pflags_use_argparse_to_create_help_option.patch patch_name: pflags_use_argparse_to_create_help_option.patch present_in_specfile: true location_in_specfile: 2 --- diff --git a/pflags b/pflags index abfcfe9..a1667fc 100755 --- a/pflags +++ b/pflags @@ -1,4 +1,4 @@ -#! /usr/bin/python +#! /usr/bin/python3 # -*- python -*- # -*- coding: utf-8 -*- # print process flags @@ -14,8 +14,9 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. -from __future__ import print_function + import procfs, re, fnmatch, sys +import argparse from functools import reduce from six.moves import map @@ -38,8 +39,13 @@ def main(argv): global ps ps = procfs.pidstats() + parser = argparse.ArgumentParser(description='Print process flags') + parser.add_argument('pid', nargs='*', help='a list of pids or names') + args = parser.parse_args() + if (len(argv) > 1): - pids = reduce(lambda i, j: i + j, list(map(thread_mapper, argv[1].split(",")))) + pids = args.pid + pids = reduce(lambda i, j: i + j, list(map(thread_mapper, pids))) else: pids = list(ps.processes.keys())