Skip to content

Commit

Permalink
Initial implementation (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
cristaloleg authored Apr 12, 2024
1 parent f1534d9 commit 367fc19
Show file tree
Hide file tree
Showing 7 changed files with 116 additions and 1 deletion.
18 changes: 18 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: 2
updates:
- package-ecosystem: "gomod"
commit-message:
prefix: "deps:"
directory: "/"
schedule:
interval: "weekly"
day: "sunday"
time: "09:00"
- package-ecosystem: "github-actions"
commit-message:
prefix: "ci:"
directory: "/"
schedule:
interval: "weekly"
day: "sunday"
time: "09:00"
17 changes: 17 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: build

on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: '0 0 * * 0' # run "At 00:00 on Sunday"

# See https://github.com/cristalhq/.github/.github/workflows
jobs:
build:
uses: cristalhq/.github/.github/workflows/[email protected]

vuln:
uses: cristalhq/.github/.github/workflows/[email protected]
1 change: 1 addition & 0 deletions GUIDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Guide for osx
51 changes: 50 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,50 @@
# osx
# osx

[![build-img]][build-url]
[![pkg-img]][pkg-url]
[![reportcard-img]][reportcard-url]
[![coverage-img]][coverage-url]
[![version-img]][version-url]

TODO

## Features

* Simple API.

See [GUIDE.md](https://github.com/cristalhq/osx/blob/main/GUIDE.md) for more details.

## Install

Go version 1.18+

```
go get github.com/cristalhq/osx
```

## Example

```go
TODO
```

Also see examples: [example_test.go](https://github.com/cristalhq/osx/blob/main/example_test.go).

## Documentation

See [these docs][pkg-url].

## License

[MIT License](LICENSE).

[build-img]: https://github.com/cristalhq/osx/workflows/build/badge.svg
[build-url]: https://github.com/cristalhq/osx/actions
[pkg-img]: https://pkg.go.dev/badge/cristalhq/osx
[pkg-url]: https://pkg.go.dev/github.com/cristalhq/osx
[reportcard-img]: https://goreportcard.com/badge/cristalhq/osx
[reportcard-url]: https://goreportcard.com/report/cristalhq/osx
[coverage-img]: https://codecov.io/gh/cristalhq/osx/branch/main/graph/badge.svg
[coverage-url]: https://codecov.io/gh/cristalhq/osx
[version-img]: https://img.shields.io/github/v/release/cristalhq/osx
[version-url]: https://github.com/cristalhq/osx/releases
1 change: 1 addition & 0 deletions example_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package osx_test
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/cristalhq/osx

go 1.18
26 changes: 26 additions & 0 deletions osx.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package osx

import (
"os"
)

// IsFile reports wheter file exists.
func IsFile(filename string) bool {
return exists(filename, false)
}

// IsDir reports wheter directory exists.
func IsDir(dirname string) bool {
return exists(dirname, true)
}

func exists(name string, dir bool) bool {
switch info, err := os.Stat(name); {
case os.IsNotExist(err):
return false
case dir:
return info.IsDir()
default:
return !info.IsDir()
}
}

0 comments on commit 367fc19

Please sign in to comment.