CLI.-.Pastes.mp4
It is Inspired from ( https://github.com/codemyst/pastemyst )
This script allows users to create, view, and manage text pastes. It provides a simple command-line interface for creating new pastes and viewing existing ones.
create: Create a new paste.view: View an existing paste.exit: Exit the script.
The script imports several modules including
json----------->for parsing and generating JSON dataplatform------>to access underlying platform’s identifying dataos-------------->for a portable way of using operating system dependent functionalityrich.console->enables rich text and beautiful formatting in the terminalrich.syntax-->allows syntax highlighting of code snippetsquestionary-->for creating interactive prompts and questionnairespyperclip---->access to the clipboard for copying and pastingrandom------->used for generating random numbers and selecting random elementsstring------->provides a collection of string constants, useful for generating random strings
- The script checks if a 
JSONfile named 'UserData.json' exists. 
- If it doesn't exist, it creates a new one and stores the user's operating system information in it.
 
- The script also defines a function 'update_json' that updates the user's data in a JSON file named 'data.json'.
 
- The script then enters a while loop that prompts the user to select an action: create, view, or exit.
 
- If the user selects 'create', the script prompts for confirmation, paste name, and checks the user's operating system.
 
- If the operating system is Windows, it creates an empty text file, opens it with notepad, reads the entered data, and stores it in a variable 'pdData'.
 
- The script then generates a unique ID and checks if it already exists in the 'data.json' file.
 
- If it doesn't exist, it updates the JSON file with the paste name, ID, and data, and removes the temporary text file.
 
- If the user selects 'view', the script prompts for an ID and checks if it exists in the 'data.json' file.
 
- If it exists, it prints the paste content using the rich.syntax module, prompts the user to copy the content to the clipboard, and copies it if requested.
 
- If the user selects 'exit', the script breaks out of the while loop and terminates.
 
- If an unknown command is entered, the script prints a message to try again.