Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
Major Project Handcrafted
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
jonathan.poalses
Major Project Handcrafted
Commits
f230caf7
Commit
f230caf7
authored
Apr 27, 2023
by
Jonathan Poalses
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial project scaffolding added
parent
18c63815
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
177 additions
and
0 deletions
+177
-0
.gitignore
.gitignore
+16
-0
project.clj
project.clj
+67
-0
main.clj
src/poalses/jonathan/dialect/main.clj
+94
-0
No files found.
.gitignore
0 → 100644
View file @
f230caf7
/target
/classes
/checkouts
profiles.clj
pom.xml
pom.xml.asc
*.jar
*.class
/.lein-*
/.nrepl-port
/.prepl-port
.hgignore
.hg/
.idea/
*.iml
.clj-kondo
project.clj
0 → 100644
View file @
f230caf7
(
defproject
poalses.jonathan/dialect
"0.0.1"
:description
"A handcrafted dialect detector for CS major project"
:url
"https://git.ysjcs.net:8888/jonathan.poalses/major-project-handcrafted"
:scm
{
:name
"git"
:url
"https://git.ysjcs.net:8888/jonathan.poalses/major-project-handcrafted.git"
}
:pom-addition
(
:developers
[
:developer
[
:id
"jonathan.poalses"
]
[
:name
"Jonathan Poalses"
]
[
:url
"https://ysjcs.net/~jonathan.poalses/"
]
[
:roles
[
:role
"developer"
]
[
:role
"maintainer"
]]])
:dependencies
[[
org.clojure/clojure
"1.11.1"
]
;; tools.namespace
[
org.clojure/tools.namespace
"1.3.0"
]
;; java.data
[
org.clojure/java.data
"1.0.95"
]
;; Logging
[
com.taoensso/timbre
"6.1.0"
]
[
com.fzakaria/slf4j-timbre
"0.3.21"
]
;; Profiling
[
com.taoensso/tufte
"2.4.5"
]
;; Lifecycle management
[
integrant
"0.8.0"
]
[
integrant/repl
"0.3.2"
]
;; Command line parsing
[
org.clojure/tools.cli
"1.0.214"
]
;; SCI
[
org.babashka/sci
"0.7.39"
]
;; nREPL
[
babashka/babashka.nrepl
"0.0.7"
]
[
org.nrepl/incomplete
"0.1.0"
]
;; OpenJFX
[
org.openjfx/javafx-controls
"20"
]
[
org.openjfx/javafx-base
"20"
]
[
org.openjfx/javafx-graphics
"20"
]
[
org.openjfx/javafx-media
"20"
]
[
org.openjfx/javafx-web
"20"
]]
:jvm-opts
[
"--enable-preview"
]
:main
^
:skip-aot
poalses.jonathan.dialect.main
:target-path
"target/%s"
:plugins
[[
lein-localrepo
"0.5.4"
]
[
lein-cloverage
"1.2.4"
]
[
lein-codox
"0.10.8"
]]
:codox
{
:metadata
{
:doc/format
:markdown
}
:project
{
:name
"Dialect Detector"
:description
"A handcrafted dialect detector for CS major project."
}}
:cloverage
{
:ns-exclude-regex
[
#
".*-debug"
#
".*main"
]}
:profiles
{
:uberjar
{
:aot
:all
:jvm-opts
[
"-Dclojure.compiler.direct-linking=true"
]}
:dev
{
:jvm-opts
[
"-XX:-OmitStackTraceInFastThrow"
]}
:test
{
:plugins
[[
lein-test-report-junit-xml
"0.2.0"
]]
:dependencies
[[
com.github.seancorfield/expectations
"2.0.165"
]]}
:deploy
{
:plugins
[]}}
:repl-options
{
:init-ns
user
:init
(
do
(
set!
*print-length*
50
)
(
set!
*print-level*
20
))})
src/poalses/jonathan/dialect/main.clj
0 → 100644
View file @
f230caf7
(
ns
poalses.jonathan.dialect.main
"Dialect detector entrypoint"
{
:author
"Jonathan Poalses"
}
(
:require
[
clojure.string
:as
string
]
[
clojure.tools.cli
:as
cli
]
[
taoensso.timbre
:as
log
])
(
:gen-class
))
(
def
^
:private
log-levels
"Supported log levels"
#
{
:trace
:debug
:info
:warn
:error
:fatal
})
(
def
command-line-options
"Command line options parsing rules."
[[
"-l"
"--log-level LEVEL"
(
str
"Logging level "
(
seq
log-levels
))
:default
:info
:parse-fn
#
(
keyword
(
string/join
(
rest
%
)))
:validate
[
#
(
contains?
log-levels
%
)
(
str
"Must be one of: "
(
seq
log-levels
))]]
[
"-d"
"--development"
"Development mode"
:default
false
]
[
"-h"
"--help"
"Displays usage"
:default
false
]])
(
defn-
print-usage
[
options-summary
]
(
println
(
->>
[
"Dialect Detector"
""
"Usage: dialect-detector [options]"
""
"Options:"
options-summary
""
"Please refer to the manual page for more information."
]
(
string/join
\n
ewline
))))
(
defn
process-args
"Processes command line `args`.
If help was requested, prints a usage message and exits.
If any problems were encountered parsing the command line, prints the errors and exits.
Returns map of parsed options:
| Key | Value
|--------------|------
| :development | Boolean development mode flag
| :log-level | Desired logging level, one of (:trace :debug :info :warn :error :fatal)
"
[
args
]
(
let
[{
:keys
[
options
errors
summary
]}
(
cli/parse-opts
args
command-line-options
)]
(
cond
(
:help
options
)
(
do
(
print-usage
summary
)
(
System/exit
0
))
errors
(
do
(
println
"Dialect Detector\n"
(
string/join
\n
ewline
errors
))
(
System/exit
-1
))
:else
options
)))
(
defn
-main
"Dialect Detector entrypoint."
[
&
args
]
(
let
[
options
(
process-args
args
)]
(
require
'
[
taoensso.timbre
:as
log
])
(
log/set-min-level!
(
:log-level
options
))
(
log/debug
"Starting Dialect Detector..."
)
(
try
(
let
[
shutdown-trigger
(
promise
)
_bye-testing-hack
(
future
(
Thread/sleep
6000
)
(
deliver
shutdown-trigger
true
))]
(
log/info
"Dialect Detector started up."
)
@
shutdown-trigger
(
log/info
"Dialect Detector shutting down..."
))
(
catch
Exception
e
(
log/fatal
"Dialect Detector encountered a problem."
e
)
(
System/exit
-666
)))
(
log/info
"Dialect Detector shut down."
)
(
shutdown-agents
)
(
System/exit
0
)))
;;==============================================================================
;;TINKERING
;;==============================================================================
(
comment
*e
)
;
; HissyBots REPL Service.
;
; Copyright (c) 2023, Hissycode Ltd. All rights reserved.
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment