Init project
This commit is contained in:
commit
574e41800d
21
LICENSE
Normal file
21
LICENSE
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2015 Joe Martella
|
||||||
|
|
||||||
|
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.
|
14
scatter.nimble
Normal file
14
scatter.nimble
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
# Package
|
||||||
|
|
||||||
|
version = "0.1.0"
|
||||||
|
author = "mollusk"
|
||||||
|
description = "idk"
|
||||||
|
license = "MIT"
|
||||||
|
srcDir = "src"
|
||||||
|
bin = @["scatter"]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Dependencies
|
||||||
|
|
||||||
|
requires "nim >= 1.0.2"
|
3
src/.gitignore
vendored
Normal file
3
src/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
scatter
|
||||||
|
src/scatter
|
||||||
|
.vscode
|
8
src/README.md
Normal file
8
src/README.md
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
## Usage
|
||||||
|
|
||||||
|
```
|
||||||
|
git clone https://gitbutter.pw/mollusk/scatter.git
|
||||||
|
cd scatter
|
||||||
|
nimble build
|
||||||
|
./scatter -h
|
||||||
|
```
|
73
src/scatter.nim
Normal file
73
src/scatter.nim
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
# This is just an example to get you started. A typical binary package
|
||||||
|
# uses this file as the main entry point of the application.
|
||||||
|
import system, os, random, strutils
|
||||||
|
when isMainModule:
|
||||||
|
|
||||||
|
#[
|
||||||
|
proc truck() =
|
||||||
|
|
||||||
|
while true:
|
||||||
|
write(stdout, "What kind of truck?: ")
|
||||||
|
|
||||||
|
let myFilePath = "/home/mollusk/Documents/"
|
||||||
|
let myFile = "give_a_shit.txt"
|
||||||
|
let lines = [readLine(stdin)]
|
||||||
|
|
||||||
|
let f = open(myFilePath & myFile, fmWrite)
|
||||||
|
defer: f.close()
|
||||||
|
|
||||||
|
for line in lines:
|
||||||
|
f.writeLine(line.toUpper)
|
||||||
|
]#
|
||||||
|
|
||||||
|
|
||||||
|
proc geussNum() =
|
||||||
|
randomize()
|
||||||
|
var rng = rand(101)
|
||||||
|
while true:
|
||||||
|
stdout.write("Type a number: ")
|
||||||
|
var sroll = readLine(stdin)
|
||||||
|
var iroll = parseInt(sroll)
|
||||||
|
if rng > iroll:
|
||||||
|
echo "Number is greater"
|
||||||
|
elif rng < iroll:
|
||||||
|
echo "Number is less"
|
||||||
|
elif rng == iroll:
|
||||||
|
echo "Winner!"
|
||||||
|
quit(0)
|
||||||
|
else:
|
||||||
|
echo "not a number"
|
||||||
|
|
||||||
|
|
||||||
|
proc help(): string =
|
||||||
|
result = """
|
||||||
|
|
||||||
|
scatter [-a, -b, -k, -r]
|
||||||
|
|
||||||
|
-a prints 'yay'
|
||||||
|
-b prints 'Oh, yeah'
|
||||||
|
-k prints 'kill'
|
||||||
|
-r Guess the number (1..100)
|
||||||
|
"""
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var argv = commandLineParams()
|
||||||
|
|
||||||
|
for args in argv:
|
||||||
|
case args:
|
||||||
|
of "":
|
||||||
|
echo help()
|
||||||
|
of "-a":
|
||||||
|
echo "yay"
|
||||||
|
of "-b":
|
||||||
|
echo "Oh yeah!"
|
||||||
|
of "-k":
|
||||||
|
echo "kill"
|
||||||
|
of "-r":
|
||||||
|
geussNum()
|
||||||
|
of "-h", "--help":
|
||||||
|
echo help()
|
||||||
|
else:
|
||||||
|
echo help()
|
0
trucks.txt
Normal file
0
trucks.txt
Normal file
Loading…
x
Reference in New Issue
Block a user