ѠgdZddlZddlZddlZddlZddlmZddlmZm Z ddl m Z dZ dZ edkrejZed d d Zed dZeddZeddddeZejd kr e edSejdkr e edSeejddSdS)zl Set of useful command line options to quickly get information about available flags, their status and path N)list_flags_info)DEFAULT_FLAGS_STORAGE_PATHDEFAULT_META_STORAGE_PATH) PrettyTablect}g}|D]0}||j|j|j|jd1|jr%tt j|ddS|stddStd|dDdtj j d z d }| d |Dt|dS) aM Lists information about all available flags on server. Supports both human-readable and json formats. E.g. +--------------------------------------------------------------------+ | Name | Description | Path | Enabled | +------------+----------------------+----------------------+---------+ | first-test | My first and super | /var/cloudlinux/flag | False | | | cool flag that I can | s/enabled- | | | | use everywhere | flags.d/first- | | | | | test.flag | | | super-test | My second and super | /var/cloudlinux/flag | False | | | cool flag that I can | s/enabled- | | | | use everywhere. Used | flags.d/super- | | | | in AccelerateWP and | test.flag | | | | Immunify teams. | | | +------------+----------------------+----------------------+---------+ )name descriptionpathenabled)indentNz!No flags available on this serverc6g|]}|S) capitalize).0is /builddir/build/BUILDROOT/alt-python27-cllib-3.4.22-1.el8.cloudlinux.x86_64/opt/cloudlinux/venv/lib/python3.11/site-packages/clflags/cli.py zlist_flags..Bs 0 0 0Q\\^^ 0 0 0rl <)alignmax_table_width max_widthcPg|]#}t|$Sr)listvalues)rvalues rrzlist_flags..Gs8        r)rappendrr r r jsonprintdumpsrosget_terminal_sizecolumnsadd_rows)argsflagsresultsflagts r list_flagsr-s/*   EG  I+I|        y dj+++,,,  5 6 6 6 F  0 0WQZ 0 0 0022:R?               arcttd}tddgddd}|t |t |dS) zY Useful information about system itself: - data paths for flags and metadata )zFlags default pathzFlags metadata pathNameValuerzGeneric system informationP)rtitlerN)rrrr'ritemsr")r(r*r,s r system_infor4Nsp 98G  *    A JJtGMMOO$$%%% !HHHHHr__main__zActions with flagsz3Available manipulations that you can do with flags.action)r2r destinfoz+Prints useful information about the system.)helprzQList all available flags on this server, their paths and current reported status.z--json store_trueFzReturn response in json format)r6defaultr9)__doc__argparser!r$sysclflags.gatherrclflags.configrr prettytablerr-r4__name__ArgumentParserparseradd_subparsers subparsers add_parserinfo_subparserlist_subparser add_argument parse_argsr(r6 print_helpexitrrrrOs  QPPPPPPP######222j   & z $X $ & &F&&"I 'J **B+DDN **@+AAN< >>>     D {f D    4 3r