mirror of
https://github.com/kirill-markin/repo-to-text.git
synced 2025-12-06 03:22:23 -08:00
fail softly if clipboard not available
This commit is contained in:
parent
d5cc239e64
commit
d75e2f9f72
1 changed files with 12 additions and 6 deletions
|
|
@ -1,12 +1,13 @@
|
|||
import os
|
||||
import subprocess
|
||||
import pathspec
|
||||
import shutil
|
||||
import logging
|
||||
import argparse
|
||||
import yaml
|
||||
from datetime import datetime
|
||||
import pyperclip
|
||||
import shutil
|
||||
|
||||
# Importing the missing pathspec module
|
||||
import pathspec
|
||||
|
||||
def setup_logging(debug=False):
|
||||
logging_level = logging.DEBUG if debug else logging.INFO
|
||||
|
|
@ -185,8 +186,13 @@ def save_repo_to_text(path='.', output_dir=None) -> str:
|
|||
repo_text = file.read()
|
||||
|
||||
# Copy the contents to the clipboard
|
||||
try:
|
||||
import pyperclip
|
||||
pyperclip.copy(repo_text)
|
||||
logging.debug('Repository structure and contents copied to clipboard')
|
||||
except Exception as e:
|
||||
logging.warning('Could not copy to clipboard. You might be running this script over SSH or without clipboard support.')
|
||||
logging.debug(f'Clipboard copy error: {e}')
|
||||
|
||||
return output_file
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue