grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026a Û1j !ã@sjdZdZddlZddlZddlZddlmZddlmZdZ dZ e  e e ¡dd „Z e Z Gd d „d ƒZdS) zu This module houses the i18n setup and message function. The default is to use gettext to internationalize messages. z4.11.2éN)ÚArgumentParser)Ú SosListOptionz/usr/share/localeÚsoscCs t t|¡S©N)ÚgettextÚdgettextÚ gettext_app)Úmsg©r ú0/usr/lib/python3.9/site-packages/sos/__init__.pyÚ_defaultsr c@s0eZdZdZdd„Zdd„Zdd„Zdd „Zd S) ÚSoSaRMain entrypoint for sos from the command line Upon intialization, this class loads the basic option parser which will include the options shared by support components/subcommands. This is also where all subcommands present in the local installation are discovered, loaded, and if a matching one is found, intialized. c Cs8||_ddl}ddl}ddl}ddl}|jjdgf|jjddgf|j j gf|j j gfdœ|_ z ddl}|jjdgf|j d<Wnrtyî}zZddl}dt|jƒvr¶|jjgf|j d<n$d t|jƒvrØ|jjgf|j d<n‚WYd}~n d}~00d }|j  ¡D]F\}}|d }| d|¡d  |¡}|dj} |d |d›| ›d�7}qþd} | |} d} t| | d�|_|j ddt¡|jj dddt!›�d�|jj"dddd�|_#d|j#_$|j  ¡D]h\} }|j#j%| |d d| ›�d�} d| ›d�| _&|  ddt¡| '| ¡|dj(| d �| j)| d!��q²|j *|j¡|_+| ,¡dS)"NrZrepÚcleanerÚmask)ÚreportZcleanÚhelpÚuploadÚ collectorZcollectz sos.collectorZpexpectÚéz, ú z<30Ú z6%(prog)s [options] Available components: z1See `sos --help` for more information)ÚusageÚepilogÚactionÚextendz --versionÚversionz sos version )rrÚ componentzsos component to run)ÚdestÚmetavarrTzsos )ÚaliasesÚprogz [options])Úparser)r)-ÚcmdlineZ sos.reportZ sos.cleanerZsos.helpZ sos.uploadrZ SoSReportrZ SoSCleanerrZ SoSHelperrZ SoSUploadÚ _componentsZ sos.collectorrZ SoSCollectorÚModuleNotFoundErrorZ sos.missingÚstrr ÚmissingZMissingCollectZMissingPexpectÚitemsÚinsertÚjoinÚdescrr"ÚregisterrÚ add_argumentÚ __version__Úadd_subparsersZ subparsersÚrequiredÚ add_parserrÚ_add_common_optionsZadd_parser_optionsÚ set_defaultsÚ parse_argsÚargsÚ_init_component)Úselfr5rÚerrZ _com_stringZcomÚvaluer Ú_comr+Z usage_stringrÚcompZ_com_subparserr r r Ú__init__/sr   ü ÿ   þýý z SoS.__init__c Cs| d¡}|jddddd�|jdtdd d d d �|jd dddd�|jddddddd�|jddddddd�|jdddddd�|jdddd d!td"d#�|jd$d%d&d'd(d)d�|jd*d+d,gd-¢d.d/�| ¡}|jd0ddd1d�|jd2d3d4�|jd5d6d4�dS)7z@Adds the options shared across components to the parser zGlobal Optionsz--batchFÚ store_truezDo not prompt interactively)Údefaultrrz --config-fileÚstoreZ config_filez/etc/sos/sos.confz$specify alternate configuration file)Útyperrr>rz--debugÚdebugz6enable interactive debugging using the python debugger)rrrz-qz--quietÚquietzonly print fatal errors)rrr>rz-sz --sysrootZsysrootNz!system rootdir path (default='/')z --tmp-dirZtmp_dirz%specify alternate temporary directoryz-tz --threadsÚthreadsézNumber of threads to use)rrr>r@rz-vz --verboseÚcountÚ verbosityrzincrease verbosityz-zz--compression-typeZcompression_type)ÚautoÚgzipÚxzZnonezcompression technology to use)rÚchoicesrz --encryptz_Encrypt the archive, either prompting for a password/key or referencing an environment variablez --encrypt-keyz(Encrypt the archive using a GPG key-pair)rz--encrypt-passz$Encrypt the archive using a password)Úadd_argument_groupr-r&ÚintÚadd_mutually_exclusive_group)r7r"Z global_grpZ encrypt_grpr r r r2|s`  ÿ ý ÿ þ þ þ þ þüþÿÿzSoS._add_common_optionsc Cs¶|jj}||jvr"td|›d�ƒz@|j|d}|jrLt ¡dksLtdƒ‚||j|j|j ƒ|_ WnNty°}z6td|›d|›�ƒ|jj r’|‚t   d¡WYd}~n d}~00dS) znDetermine which component has been requested by the user, and then initialize that component. zUnknown subcommand 'z ' specifiedrz*Component must be run with root privilegeszCould not initialize 'z': rN)r5rr$ÚprintZ root_requiredÚosÚgetuidÚ Exceptionr"r#Ú _componentrAÚsysÚexit)r7r:Z_to_loadr8r r r r6¬s zSoS._init_componentcCs|j ¡dSr)rRÚexecute)r7r r r rU¿sz SoS.executeN)Ú__name__Ú __module__Ú __qualname__Ú__doc__r<r2r6rUr r r r r &s M0r )rYr.rOrSrÚargparserZ sos.optionsrZ gettext_dirrÚbindtextdomainr Z_sosr r r r r Ú s