Swift 中的 Cron-parser-challenge

cron-parser-challenge

Swift 中的 cron-parser-challenge 这是我在 swift 中完成的第一个 MacOS 命令行应用程序,所以我没有时间在 2 小时内☹️做很多事情 我本来希望在文件中按类分离练习,并完成单元测试。

开始

要求 🚧

  • 斯威夫特 5

设置 ⚙

  1. 分叉此存储库或克隆存储库或下载最新版本
  2. 在文件夹中打开终端
  3. 猫配置.txt |斯威夫特主.swift 16:10

项目文件 📁

main.swift
config.txt

描述 📁

命令行工具非常简单,在配置中.txt我们有这样的配置:

30 1 /bin/run_me_daily
45 * /bin/run_me_hourly
* * /bin/run_me_every_minute
* 19 /bin/run_me_sixty_times

我们输入这个命令(),它将返回:cat config.txt | swift main.swift 16:10

1:30 tomorrow - /bin/run_me_daily
16:45 today - /bin/run_me_hourly
16:10 today - /bin/run_me_every_minute
19:00 today - /bin/run_me_sixty_times

also if we don’t set the time parameter, it will use the device time:

cat config.txt | swift main.swift

ScreenShoots

screen

GitHub

点击跳转