git.iko.soy/SourceDocsSwift
on master help sign in
Second column justification. Print error when writing file.
commit222f41b7b869a39e0c4926882a09c62e5f6ba7c1 authorilyakooo0 <ilyakooo0@gmail.com> dateWed 29 Aug 2018, 17:04 (8 years ago) parent11e2b01
2 files changed+19−5
unifiedsplit
SourceDocsSwift/TeXer.swift+3−3 SourceDocsSwift/main.swift+16−2
SourceDocsSwift/TeXer.swift+3−3
@@ -11,7 +11,7 @@ struct TeXer {
1111 return """
1212 \\\(style.section(for: 1)){Описание классов и структур}
1313
14− \\begin{longtable}{| >{\\raggedright\\arraybackslash}p{0.55\\textwidth} | >{\\raggedright\\arraybackslash}p{0.4\\textwidth}|}
14+ \\begin{longtable}{| >{\\raggedright\\arraybackslash}p{0.55\\textwidth} | p{0.4\\textwidth}|}
1515 \\hline
1616 \\textbf{Класс или стркура} & \\textbf{Описание} \\\\ \\hline
1717 \( objects.map {"\\texttt{\($0.declaration)} & {\\color{red} TODO} \\\\ \\hline"} .joined(separator: "\n") )
@@ -26,7 +26,7 @@ struct TeXer {
2626 return """
2727 \\\(style.section(for: 2))*{\\texttt{\($0.declaration)}}
2828
29− \\begin{longtable}{| >{\\raggedright\\arraybackslash}p{0.55\\textwidth} | >{\\raggedright\\arraybackslash}p{0.4\\textwidth}|}
29+ \\begin{longtable}{| >{\\raggedright\\arraybackslash}p{0.55\\textwidth} | p{0.4\\textwidth}|}
3030 \\hline
3131 \\textbf{Поле} & \\textbf{Описание} \\\\ \\hline
3232 \( $0.fields.map {"\\texttt{\($0.declaration.prefix {$0 != "="})} & {\\color{red} TODO} \\\\ \\hline"} .joined(separator: "\n") )
@@ -47,7 +47,7 @@ struct TeXer {
4747 return """
4848 \\\(style.section(for: 2))*{\\texttt{\($0.declaration)}}
4949
50− \\begin{longtable}{| >{\\raggedright\\arraybackslash}p{0.55\\textwidth} | >{\\raggedright\\arraybackslash}p{0.4\\textwidth}|}
50+ \\begin{longtable}{| >{\\raggedright\\arraybackslash}p{0.55\\textwidth} | p{0.4\\textwidth}|}
5151 \\hline
5252 \\textbf{Метод} & \\textbf{Описание} \\\\ \\hline
5353 \( $0.methods.map {"\\texttt{\($0.declaration)} & {\\color{red} TODO} \\\\ \\hline"} .joined(separator: "\n") )
SourceDocsSwift/main.swift+16−2
@@ -70,6 +70,14 @@ while i < args.count {
7070 i += 1
7171}
7272
73+var outputIsDirectory: ObjCBool = false
74+
75+FileManager.default.fileExists(atPath: output, isDirectory: &outputIsDirectory)
76+
77+if outputIsDirectory.boolValue {
78+ output.append("/docs.tex")
79+}
80+
7381let decoder = JSONDecoder()
7482
7583guard let xcbTagetData = Shell.launch(executable: "/usr/bin/xcodebuild", arguments: ["-list", "-json"], launchDirectory: directory) else {
@@ -113,8 +121,14 @@ for target in targets {
113121
114122
115123let tex = TeXer.convert(objects: files.flatMap {$0.value}, with: style)
116−
117−try? tex.write(toFile: output, atomically: true, encoding: .utf8)
124+do {
125+ try tex.write(toFile: output, atomically: true, encoding: .utf8)
126+} catch {
127+ print("""
128+ There was an error writing the outuput file.
129+ """)
130+ exit(1)
131+}
118132
119133print("""
120134+-------+