
    Mg                     V    S SK Jr  S SKJr  \" S5      S 5       rS rS rS rS rS	 rg
)    )Fore)pluginzcaesar cipherc                 b    [        U 5      nUS:X  a  [        U 5        gUS:X  a  [        U 5        gg)z4Main function that handles the Caesar cipher plugin.      N)
get_optionplain_to_ciphercipher_to_plain)jarvissoptions      C/Users/admin/workspace/ai/Jarvis/jarviscli/plugins/caesar_cipher.pycaesar_cipher_converterr      s1     F{	1 
    c                    U R                  S[        R                  5        [        S5        [        S5        [        S5        [        5           [	        U R                  S[        R                  5      5      nUS:X  a  gUS;   a  U$ U R                  S	[        R                  5         [        5         Mf  ! [         a#    U R                  S	[        R                  5         N8f = f)
z
Presents options to the user and returns their choice.

Args:
    jarvis: The Jarvis assistant instance.

Returns:
    option (int or None): 1 for plain-to-cipher, 2 for cipher-to-plain,
                          None for exit.
z~> What can I do for you?z1: Convert plain text to cipherz2: Convert cipher to plain textz3: ExitzEnter your choice:    N)r   r   z8Invalid input! Enter a number from the choices provided.)	sayr   REDprintintinputGREENYELLOW
ValueError)r   r   s     r   r   r      s     JJ*DHH5	
+,	
+,	)	G
	`&;TZZHIF{6!

UW[WbWbc 	   	`JJQSWS^S^_	`s   /B3 >B3  B3 3*C C c                     SnU  Hl  nUR                  5       (       aP  UR                  5       (       a  [        S5      O
[        S5      nU[        [        U5      U-
  U-   S-  U-   5      -  nMh  X#-  nMn     U$ )z
Converts the text using a Caesar cipher with the specified shift.

Args:
    text (str): The input string to be converted.
    shift (int): The number of positions to shift each letter.

Returns:
    converted (str): The resulting converted string.
 Aa   )isalphaisupperordchr)textshift	convertedcharstarts        r   caesar_cipherr)   0   sn     I<<>> $CHCHEc$i%/%72=EFFII  r   c                 r    [        U 5      n[        US5      nU R                  U[        R                  5        g)zp
Converts plain text to Caesar cipher text with a shift of 3.

Args:
    jarvis: The Jarvis assistant instance.
r   Nget_user_inputr)   r   r   r   r   
user_inputr&   s      r   r	   r	   G   s,      'Jj!,I
JJy$++&r   c                 r    [        U 5      n[        US5      nU R                  U[        R                  5        g)zv
Converts Caesar cipher text back to plain text with a shift of -3.

Args:
    jarvis: The Jarvis assistant instance.
Nr+   r-   s      r   r
   r
   S   s,      'Jj"-I
JJy$++&r   c                      U R                  S5      n[        U5      S:  a  U$ U R                  S[        R                  5        MD  )z
Prompts the user to enter a string for conversion.

Args:
    jarvis: The Jarvis assistant instance.

Returns:
    user_input (str): The string entered by the user.
zEnter string to convert: r   z"String length should be minimum 1.)r   lenr   r   r   )r   r.   s     r   r,   r,   _   s@     \\"=>
z?QJJ;T[[I r   N)	coloramar   r   r   r   r)   r	   r
   r,    r   r   <module>r5      s?         B.	'	'Jr   