TermuxC 2.2.4__tar.gz → 2.2.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: TermuxC
3
- Version: 2.2.4
3
+ Version: 2.2.6
4
4
  Summary: A lightweight utility to copy text to the device clipboard using OSC 52.
5
5
  Author: Ruizennis
6
6
  License: MIT
@@ -85,6 +85,17 @@ pip install TermuxC
85
85
  ```bash
86
86
  pip uninstall TermuxC
87
87
  ```
88
+ ## Flags
89
+ |Flag|Function |
90
+ |----|----------------|
91
+ | -f | Force file read|
92
+ | -t | Force Text copy|
93
+ | -h | Show help menu |
94
+ #### Aditional flag alliases
95
+ - --file
96
+ - --text
97
+ - --help
98
+ - -help
88
99
 
89
100
  ## Requirements:
90
101
  **Python 3+**
@@ -67,6 +67,17 @@ pip install TermuxC
67
67
  ```bash
68
68
  pip uninstall TermuxC
69
69
  ```
70
+ ## Flags
71
+ |Flag|Function |
72
+ |----|----------------|
73
+ | -f | Force file read|
74
+ | -t | Force Text copy|
75
+ | -h | Show help menu |
76
+ #### Aditional flag alliases
77
+ - --file
78
+ - --text
79
+ - --help
80
+ - -help
70
81
 
71
82
  ## Requirements:
72
83
  **Python 3+**
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "TermuxC"
7
- version = "2.2.4"
7
+ version = "2.2.6"
8
8
  description = "A lightweight utility to copy text to the device clipboard using OSC 52."
9
9
  authors = [{name = "Ruizennis"}]
10
10
  requires-python = ">=3.7"
@@ -9,7 +9,7 @@ from time import sleep
9
9
  from threading import Lock
10
10
  # configuration
11
11
  Sleeptime = 0.5
12
- help = {'-h', '--help', '-help'}
12
+ helpflags = {'-h', '--help', '-help'}
13
13
  help_message = '''
14
14
  Usage:
15
15
 
@@ -38,7 +38,12 @@ from TermuxC import Copy
38
38
  with open(filename, 'r') as F:
39
39
  C = F.read()
40
40
  Copy(C)
41
-
41
+
42
+ Flags
43
+ -f • Force File file
44
+ -t • Force text copy
45
+ -h • Show help menu
46
+
42
47
  for more help see https://github.com/Ruizennis/TermuxC
43
48
  '''
44
49
  #New: added tmux support natively
@@ -79,17 +84,50 @@ def main():
79
84
  if not sys.stdin.isatty():
80
85
  readstdin = sys.stdin.read()
81
86
  if readstdin.endswith('\n'):
82
- readstdin = readstdin[:-1]
87
+ readstdin = readstdin[:-1]
88
+ if os.path.isfile(readstdin):
89
+ try:
90
+ with open(readstdin, 'r') as File:
91
+ readstdin = File.read()
92
+ except Exception as e:
93
+ print(f'Error reading file, {e}', file=sys.stderr)
94
+ sys.exit(1)
83
95
  if readstdin:
84
96
  Copy(readstdin)
85
97
  sys.exit(0)
86
98
  else:
87
99
  print('Please provide an input', file=sys.stderr)
88
100
  sys.exit(1)
89
- elif help.intersection(sys.argv):
101
+ elif helpflags.intersection(sys.argv):
90
102
  print(help_message)
91
103
  sys.exit(0)
92
104
  elif len(sys.argv) > 1:
105
+ if sys.argv[1] in ['-t', '--text']:
106
+ text = sys.stdin.read()
107
+ if text.endswith('\n'):
108
+ text = text[:-1]
109
+ Copy(text)
110
+ sys.exit(0)
111
+
112
+ elif sys.argv[1] in ['-f', '--file']:
113
+ if len(sys.argv) == 3:
114
+ file = sys.argv[2]
115
+ if os.path.isfile(file):
116
+ try:
117
+ with open(file, 'r') as filecopy:
118
+ Copy(filecopy.read())
119
+ except:
120
+ print('Error, failed to copy file.', file=sys.stderr)
121
+ else:
122
+ print('Error, invalid filepath', file=sys.stderr)
123
+ sys.exit(1)
124
+
125
+ else:
126
+ print('Error, -f flag requires a file', file=sys.stderr)
127
+ sys.exit(1)
128
+
129
+
130
+ else:
93
131
  Copy(' '.join(sys.argv[1:]))
94
132
  sys.exit(0)
95
133
  else:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: TermuxC
3
- Version: 2.2.4
3
+ Version: 2.2.6
4
4
  Summary: A lightweight utility to copy text to the device clipboard using OSC 52.
5
5
  Author: Ruizennis
6
6
  License: MIT
@@ -85,6 +85,17 @@ pip install TermuxC
85
85
  ```bash
86
86
  pip uninstall TermuxC
87
87
  ```
88
+ ## Flags
89
+ |Flag|Function |
90
+ |----|----------------|
91
+ | -f | Force file read|
92
+ | -t | Force Text copy|
93
+ | -h | Show help menu |
94
+ #### Aditional flag alliases
95
+ - --file
96
+ - --text
97
+ - --help
98
+ - -help
88
99
 
89
100
  ## Requirements:
90
101
  **Python 3+**
File without changes
File without changes