# Path: lib/fs.py
# def check_if_available(prg, msg):
# 
# Path: lib/clipboard.py
# def text_to_clipboards(text):
#     """Copy text to both clipboards."""
#     to_primary(text)
#     to_clipboard(text)


import os
import sys
import config as cfg
from lib import fs
from lib.clipboard import text_to_clipboards
The output is also copied to the clipboards.

Usage: sp <filename> [-n]

The option "-n" means normal output, i.e. spaces are not protected with
a backslash.

Last update: 2017-01-09 (yyyy-mm-dd)
"""



fs.check_if_available(cfg.XSEL, "Error: {} is not available!".format(cfg.XSEL))


def main():
    normal = False
    if "-n" in sys.argv:
        normal = True
        sys.argv.remove("-n")

    if len(sys.argv) == 1:
        text = os.getcwd()
    else:
        text = os.path.join(os.getcwd(), sys.argv[1])

    if not normal:
        text = text.replace(' ', r'\ ')
    print('# copied to the clipboard', file=sys.stderr)
    print(text)

# Path: lib/fs.py
# def check_if_available(prg, msg):
# 
# Path: lib/clipboard.py
# def text_to_clipboards(text):
#     """Copy text to both clipboards."""
#     to_primary(text)
#     to_clipboard(text)


# Path: sp.py
import os
import sys
import config as cfg
from lib import fs
from lib.clipboard import text_to_clipboards

The output is also copied to the clipboards.

Usage: sp <filename> [-n]

The option "-n" means normal output, i.e. spaces are not protected with
a backslash.

Last update: 2017-01-09 (yyyy-mm-dd)
"""



fs.check_if_available(cfg.XSEL, "Error: {} is not available!".format(cfg.XSEL))


def main():
    normal = False
    if "-n" in sys.argv:
        normal = True
        sys.argv.remove("-n")

    if len(sys.argv) == 1:
        text = os.getcwd()
    else:
        text = os.path.join(os.getcwd(), sys.argv[1])

    if not normal:
        text = text.replace(' ', r'\ ')
    print('# copied to the clipboard', file=sys.stderr)
    print(text)

    text_to_clipboards(text)