<commit_before>FasdUAS 1.101.10
k
l
 tystrings.scpt		
 tystrings.scpt



l




l

 The MIT License (MIT), The MIT License (MIT)

l
  
l
(" Copyright (c) 2017 luckytianyiyanD Copyright (c) 2017 luckytianyiyan

l



 
 
 !
 l"#
"SM Permission is hereby granted, free of charge, to any person obtaining a copy#$$ Permission is hereby granted, free of charge, to any person obtaining a copy!%&
%l'(
'TN of this software and associated documentation files (the "Software"), to deal()) of this software and associated documentation files (the "Software"), to deal&*+
*l,-
,SM in the Software without restriction, including without limitation the rights-.. in the Software without restriction, including without limitation the rights+/0
/l12
1PJ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell233 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell045
4l67
6LF copies of the Software, and to permit persons to whom the Software is788 copies of the Software, and to permit persons to whom the Software is59:
9l;<
;?9 furnished to do so, subject to the following conditions:<==r furnished to do so, subject to the following conditions::>?
>l@A
@ ABB ?CD
ClEF
EUO The above copyright notice and this permission notice shall be included in allFGG The above copyright notice and this permission notice shall be included in allDHI
HlJK
J60 copies or substantial portions of the Software.KLL` copies or substantial portions of the Software.IMN
MlOP
O PQQ NRS
RlTU
TQK THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORUVV THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORSWX
WlYZ
YOI IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,Z[[ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,X\]
\l^_
^RL FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE_`` FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE]ab
alcd
cMG AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERdee AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERbfg
flhi
hTN LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,ijj LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,gkl
klmn
mTN OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THEnoo OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THElpq
plrs
r
 SOFTWARE.stt SOFTWARE.quv
ulvwx
wlxyz
yl	{
{r	|}
|c~
~I
 0getcurrentpathgetCurrentPath
m

alis
}o
0
currentpath
currentPathz
l
l

I

 0activateitermsactivateiTerms
l
I
 0setwindowtitlesetWindowTitle
m
TyStrings Demo
l
l
 cd to repo root path* cd to repo root path
l%
I%
0
runcommand
runCommand
b!
b
mcd 
l

n

1



strq
n

1


psxp
o
0
currentpath
currentPath
m ../
l&,
I&,
0
runcommand
runCommand
m'(0source venv/bin/activate
l-3
I-3
0
runcommand
runCommand
m./"cd tests/example/
l49
I49
	0clear
l:@
I:@
0
runcommand
runCommand
m;<>ttyrec ../../resource/recording
lAF
IAF
.sysodelanullnmbr
mAB?
lGZ
IGZ
00runtystringssubcommandrunTyStringsSubCommand
mHKgenerate
JKV
mKN($(find . -name \*.m)
mNQ-o
mQT,en.lproj zh-Hans.lproj
l[`
I[`
.sysodelanullnmbr
m[\
laf
Iaf
	0clear
lg
Ig
00runtystringssubcommandrunTyStringsSubCommand
mhktranslate
Jk
mkn>strings/base_translator.strings
mnqJzh-Hans.lproj/base_translator.strings
mqt--dst-lang
mtwzh
mwz--src-lang
mz}en
l
I
.sysodelanullnmbr
m
l
I
	0clear
l
I	
00runtystringssubcommandrunTyStringsSubCommand	



m



diff

J
m*strings/diff1.strings
m*strings/diff2.strings
l~
I}|
}.sysodelanullnmbr
m{{|~

l
zy

Ixwv
x	0clearwvzy



l ut
 Is!r
s00runtystringssubcommandrunTyStringsSubCommand!"#
"m$$%%lint#&q
&J''(p
(m))**(strings/lint.stringspqrut+,
+l-on
-Im.l
m.sysodelanullnmbr
.mkklon,/0
/l1ji
1Ih2g
h0
runcommand
runCommand23f
3m4455exitfgji067
6l8ed
8Ic9b
c.sysodelanullnmbr
9m::?bed7;<
;l=a`
=I_>^
_0
runcommand
runCommand>?]
?b@A
@bBC
BmDDEEcd 
ClF\[
FnGH
G1Z
Z
strq
HnIJ
I1Y
Y
psxp
JoX
X0
currentpath
currentPath\[
AmKKLL../]^a`<MN
MlOWV
OIUPT
U0
runcommand
runCommandPQS
QmRRSSdeactivateSTWVNTU
TlVRQ
VIPWO
P0
runcommand
runCommandWXN
XmYYZZ8ttygif resource/recording -fNORQU[\
[l]ML
]IK^J
K0
runcommand
runCommand^_I
_m``aaBmv tty.gif resource/tystrings.gifIJML\bc
blHGFHGFcde
dlEfgE
f
 cleanghh
 cleaneij
ilkDC
kIBlA
B0
runcommand
runCommandlm@
mmnnoo:rm -rf tests/example/en.lproj@ADCjpq
pl	r?>
rI	=s<
=0
runcommand
runCommandst;
tm

uuvvDrm -rf tests/example/zh-Hans.lproj;<?>qwx
wl:98:98xyz
yl7{|7
{(" ------- TyStrings Helper ------- |}}D ------- TyStrings Helper ------- z~
~l654654
i
I321
3(0rungeneratecommandrunGenerateCommand21
l0/.0/.
l-,+-,+
i
I*)
*00runtystringssubcommandrunTyStringsSubCommand
o(
(0
subcommand'
o&
&0args')
k@
I%$
%
0
typingstring
typingString#
mtys#$
I"!
".0typingstringwithdelaytypingStringWithDelay
m	trings  
m	
 !
I




0
typingstring
typingString

b
o
0
subcommand
m 


Y7
I&2
.0typingstringwithdelaytypingStringWithDelay
b'-
n'+
4(+

cobj
o)*
0i
o'(
0args
m+, 
m-.?zG{
0i
m

I
!
.corecnte********
o


0args
l88

 typing '\n' typing '\n'
I8>




0
typingstring
typingString

m9:




l??		

l
l

 ------- Core ------- , ------- Core ------- 
l
i

I

0
typingstring
typingString
o

0content
I
.0typingstringwithdelaytypingStringWithDelay
o

0content
m?
l
i

I
.0typingstringwithdelaytypingStringWithDelay
o

0content
o
0dy
OB
OA
k
@
r

l

n

7


cha 
m
l
n
1

leng
o

0content
o



0content
o
0charlistcharList
X
@
k,;
I,5
.Itrmsntxnullobj 

Text
o./
0char

Wtnl
m01

savono  
I6;
.sysodelanullnmbr
o67
0dy
0char
o 
0charlistcharList
n	
1	

Wcsn
1

Crwn
mITRMalis@	Macintosh6]H+٣	iTerm.app1Glے	 
Applications6.lk٣!Macintosh:Applications:iTerm.app	iTerm.app	MacintoshApplications/iTerm.app/
l
i
I
0
runcommand
runCommand
o

0command
O	

	O



I

.Itrmsntxnullobj 


Text
o

0command

n	
1	

Wcsn
1

Crwn

mITRMalis@	Macintosh6]H+٣	iTerm.app1Glے	 
Applications6.lk٣!Macintosh:Applications:iTerm.app	iTerm.app	MacintoshApplications/iTerm.app/
l
i
I
	0clear
k

I
0
runcommand
runCommand


m




clear
I
 
.sysodelanullnmbr
 m!!?"#
"l#$%
$i&'
&I(

0
isapprunning
isAppRunning()
)o
0appnameappName
'O
*+
*E
,-
,l	.
.n	/0
/1	

pnam
02

prcs
-o	

0appnameappName
+m11sevsalis	Macintosh6]H+٣}System Events.appܠÓ	 
CoreServices6.#(
٣}٣|٣{:Macintosh:System:Library:CoreServices:System Events.app$System Events.app	Macintosh-System/Library/CoreServices/System Events.app/%23
2l345
4i
67
6I8
 0setwindowtitlesetWindowTitle89
9o
	0title
7I
:
0
runcommand
runCommand:;
;b<=
<b>?
>m@@AA
echo -e "\033];
?o
	0title
=mBBCC
\007"5DE
DlEFG
Fi #HI
HI
 0activateitermsactivateiTerms
IZJKL
JIM

0
isapprunning
isAppRunningMN
NmOOPP
iTerm
KO	QR
QI

.miscactvnullnull
Rm	
SSITRMalis@	Macintosh6]H+٣	iTerm.app1Glے	 
Applications6.lk٣!Macintosh:Applications:iTerm.app	iTerm.app	MacintoshApplications/iTerm.app/
LIT
.miscactvnullnull
TmUUITRMalis@	Macintosh6]H+٣	iTerm.app1Glے	 
Applications6.lk٣!Macintosh:Applications:iTerm.app	iTerm.app	MacintoshApplications/iTerm.app/GVW
VlWXY
Xi$'Z[
ZI
 0getcurrentpathgetCurrentPath
[O\]
\L
^
^n
_`
_m	


ctnr
`l	a
aI	b
.earsffdralis afdr
bf
]mccMACSalisl	Macintosh6]H+٣}
Finder.app9JH	 
CoreServices6.HA
٣}٣|٣{3Macintosh:System:Library:CoreServices:Finder.app
Finder.app	Macintosh&System/Library/CoreServices/Finder.app/Yd
dl
efghijklmnope
~}|{
(0rungeneratecommandrunGenerateCommand
00runtystringssubcommandrunTyStringsSubCommand

0
typingstring
typingString
.0typingstringwithdelaytypingStringWithDelay
0
runcommand
runCommand
	0clear

0
isapprunning
isAppRunning
~ 0setwindowtitlesetWindowTitle
} 0activateitermsactivateiTerms
| 0getcurrentpathgetCurrentPath
{.aevtoappnull****fzyxqrw
z(0rungeneratecommandrunGenerateCommandyxqrwhgvutsts
v00runtystringssubcommandrunTyStringsSubCommandururuqp
q0
subcommand
p0argstsonm
o0
subcommand
n0args
m0it
lkji
l
0
typingstring
typingString
k.0typingstringwithdelaytypingStringWithDelay
j.corecnte********
i
cobjsA*k+O*jl+O*%k+O
kj
kh
*/%l+[OYO*k+OPhhgfvwe
h
0
typingstring
typingStringgdxdxc
c
0contentfvb
b
0contentwa
a.0typingstringwithdelaytypingStringWithDelaye*l+i`_^yz]
`.0typingstringwithdelaytypingStringWithDelay_\{\{[Z
[
0content
Z0dy^yYXWV
Y
0content
X0dy
W0charlistcharList
V0charzUTSRQPONMLKJI
U
Crwn
T
Wcsn
S
cha 
R
leng
Q
kocl
P
cobj
O.corecnte********
N
Text
M
Wtnl
L
savono  K
J.Itrmsntxnullobj 
I.sysodelanullnmbr]C?*,,6[\[Zk\Z,2EO#[l
kh*

Oj

[OYUUjHGF|}E
H0
runcommand
runCommandGD~D~C
C
0commandF|B
B
0command}A@?>
A
Crwn
@
Wcsn
?
Text
>.Itrmsntxnullobj E*,,	*l
UUk=<;:
=	0clear<;
9!8
90
runcommand
runCommand
8.sysodelanullnmbr:
*k+Oj
l7'654
7
0
isapprunning
isAppRunning6332
20appnameappName51
10appnameappName10/
0
prcs
/
pnam4
	*-,Um.7-,+
. 0setwindowtitlesetWindowTitle-**)
)	0title,(
(	0title@B'
'0
runcommand
runCommand+
*%%k+n&I%$#
& 0activateitermsactivateiTerms%$O"S!
"
0
isapprunning
isAppRunning
!.miscactvnullnull#
*k+
*j
UYj
o [


  0getcurrentpathgetCurrentPath
c


.earsffdralis afdr

ctnr

)j
,EUp
.aevtoappnull****
ky
+/6;MT[ip+




$)4DKRY`nu
 0getcurrentpathgetCurrentPath

alis
0
currentpath
currentPath
 0activateitermsactivateiTerms
 0setwindowtitlesetWindowTitle

psxp

strq
0
runcommand
runCommand

	0clear

.sysodelanullnmbr

00runtystringssubcommandrunTyStringsSubCommand
*j+&EO*j+O*k+O*,,%%k+
O*k+
O*k+
O*j+
O*k+
Oj
O*aaaamvl+Olj
O*j+
O*aaaaaaa
a
vl+Olj
O*j+
O*a
aa lvl+Olj
O*j+
O*a!a"kvl+Olj
O*a#k+
Oj
O*a$,,%a%%k+
O*a&k+
O*a'k+
O*a(k+
O*a)k+
O*a*k+
ascr
ޭ<commit_msg>Modify tystrings.scpt<commit_after>-- tystrings.scpt
--
-- The MIT License (MIT)
-- 
-- Copyright (c) 2017 luckytianyiyan
-- 
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
-- in the Software without restriction, including without limitation the rights
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
-- 
-- The above copyright notice and this permission notice shall be included in all
-- copies or substantial portions of the Software.
-- 
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-- SOFTWARE.
--

set currentPath to getCurrentPath() as alias

activateiTerms()
setWindowTitle("TyStrings Demo")

# cd to repo root path
runCommand("cd " & (quoted form of POSIX path of currentPath) & "../")
runCommand("source venv/bin/activate")
runCommand("cd tests/example/")
clear()
runCommand("ttyrec ../../resource/recording")
delay 0.5
runTyStringsSubCommand("generate", {"$(find . -name \\*.m)", "-o", "en.lproj zh-Hans.lproj"})
delay 2
clear()
runTyStringsSubCommand("translate", {"strings/base_translator.strings", "zh-Hans.lproj/base_translator.strings", "--dst-lang", "zh", "--src-lang", "en"})
delay 2
clear()
runTyStringsSubCommand("diff", {"strings/diff1.strings", "strings/diff2.strings"})
delay 2
clear()
runTyStringsSubCommand("lint", {"strings/lint.strings"})
delay 2
runCommand("exit")
delay 0.5
runCommand("cd " & (quoted form of POSIX path of currentPath) & "../")
runCommand("deactivate")
runCommand("ttygif resource/recording -f")
runCommand("mv tty.gif resource/tystrings.gif")

# clean
runCommand("rm -rf tests/example/en.lproj")
runCommand("rm -rf tests/example/zh-Hans.lproj")

# ------- TyStrings Helper ------- 

on runTyStringsSubCommand(subcommand, args)
	typingString("tys")
	typingStringWithDelay("trings ", 0)
	typingString(subcommand & " ")
	repeat with i from 1 to count of args
		typingStringWithDelay(item i of args & " ", 0.02)
	end repeat
	# typing '\n'
	typingString("
")
	
end runTyStringsSubCommand

# ------- Core ------- 

on typingString(content)
	typingStringWithDelay(content, 0.1)
end typingString

on typingStringWithDelay(content, dy)
	tell application "iTerm"
		tell current session of current window
			set charList to (characters 1 thru (length of content) of content)
			repeat with char in charList
				write text char newline no
				delay dy
			end repeat
		end tell
	end tell
end typingStringWithDelay

on runCommand(command)
	tell application "iTerm"
		tell current session of current window
			write text command
		end tell
	end tell
end runCommand

on clear()
	runCommand("clear")
	delay 0.1
end clear

on isAppRunning(appName)
	tell application "System Events" to (name of processes) contains appName
end isAppRunning

on setWindowTitle(title)
	runCommand("echo -e \"\\033];" & title & "\\007\"")
end setWindowTitle

on activateiTerms()
	if isAppRunning("iTerm") then
		tell application "iTerm"
			activate
		end tell
	else
		activate application "iTerm"
	end if
end activateiTerms

on getCurrentPath()
	tell application "Finder"
		return container of (path to me)
	end tell
end getCurrentPath
{'fraction_non_alphanumeric': 0.49067020457074384, 'fraction_numerical': 0.015235812719335787, 'mean_word_length': 9.00728051391863, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1640991', 'n_tokens_mistral': 17293, 'n_tokens_neox': 17083, 'n_words': 1506}