Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Environment variables
.env

# Build artifacts
SatIntel
SatIntel.exe
*.exe

# Go workspace file
go.work

# Documentation files
IMPROVEMENTS.md
TESTING.md

# Test runner (build ignore, but keep in repo)
run_tests
run_tests.exe

# User favorites data
favorites.json
.satintel/
47 changes: 47 additions & 0 deletions QUICK_TEST.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Quick Test Reference

## Run All Tests
```bash
go run run_tests.go -all
```

## Run Specific Module
```bash
go run run_tests.go -module=main
go run run_tests.go -module=osint
go run run_tests.go -module=cli
```

## Common Commands

| Command | What It Does |
|---------|--------------|
| `go run run_tests.go -all` | Run all test modules |
| `go run run_tests.go -all -cover` | Run all tests with coverage |
| `go run run_tests.go -module=main -v` | Run main tests verbosely |
| `go run run_tests.go -module=list` | List available modules |
| `go run run_tests.go -check` | Check test file status |
| `go run run_tests.go -help` | Show full help |

## Adding New Test Module

1. Create test file: `newpackage/newpackage_test.go`
2. Add to `run_tests.go`:
```go
{
Name: "newpackage",
Description: "Your description",
PackagePath: "./newpackage",
TestFile: "newpackage_test.go",
},
```
3. Run: `go run run_tests.go -module=newpackage`

## Direct Go Test (Alternative)

```bash
go test ./... # All tests
go test -cover ./... # With coverage
go test -v ./main # Specific package
```

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
- Parse Two Line Elements (TLE)

### Preview
<img src="https://github.com/ANG13T/SatIntel/blob/main/assets/image.png" alt="SatIntel Image" width="600"/>
<img src="./assets/image.png" alt="SatIntel Image" width="600"/>

### Usage
Make an account at [**Space Track**](https://space-track.org) save username and password.
Expand Down
75 changes: 55 additions & 20 deletions cli/cli.go
Original file line number Diff line number Diff line change
@@ -1,68 +1,103 @@
package cli

import (
"bufio"
"fmt"
"io/ioutil"
"github.com/iskaa02/qalam/gradient"
"github.com/TwiN/go-color"
"github.com/ANG13T/SatIntel/osint"
"strconv"
"os"
"os/exec"
"runtime"
"strconv"

"github.com/ANG13T/SatIntel/osint"
"github.com/TwiN/go-color"
"github.com/iskaa02/qalam/gradient"
)

// Option prompts the user to select a menu option and validates the input.
// It recursively prompts until a valid option between 0 and 4 is entered.
func Option() {
fmt.Print("\n ENTER INPUT > ")
var selection string
fmt.Scanln(&selection)
num, err := strconv.Atoi(selection)
if err != nil {
if err != nil {
fmt.Println(color.Ize(color.Red, " [!] INVALID INPUT"))
Option()
} else {
if (num >= 0 && num < 5) {
} else {
if num >= 0 && num < 5 {
DisplayFunctions(num)
} else {
fmt.Println(color.Ize(color.Red, " [!] INVALID INPUT"))
Option()
}
}
}
}

// DisplayFunctions executes the selected function based on the menu choice.
// After execution, it waits for user input, clears the screen, and shows the menu again.
func DisplayFunctions(x int) {
if (x == 0) {
if x == 0 {
fmt.Println(color.Ize(color.Blue, " Escaping Orbit..."))
os.Exit(1)
} else if (x == 1) {
} else if x == 1 {
osint.OrbitalElement()
waitForEnter()
clearScreen()
Banner()
Option()
} else if (x == 2) {
} else if x == 2 {
osint.SatellitePositionVisualization()
waitForEnter()
clearScreen()
Banner()
Option()
} else if (x == 3) {
} else if x == 3 {
osint.OrbitalPrediction()
waitForEnter()
clearScreen()
Banner()
Option()
}else if (x == 4) {
} else if x == 4 {
osint.TLEParser()
waitForEnter()
clearScreen()
Banner()
Option()
}
}

// Banner displays the application banner, info, and menu options with gradient colors.
func Banner() {
banner, _ := ioutil.ReadFile("txt/banner.txt")
info, _ := ioutil.ReadFile("txt/info.txt")
options, _ := ioutil.ReadFile("txt/options.txt")
g,_:=gradient.NewGradient("cyan", "blue")
solid,_:=gradient.NewGradient("blue", "#1179ef")
opt,_:=gradient.NewGradient("#1179ef", "cyan")
banner, _ := os.ReadFile("txt/banner.txt")
info, _ := os.ReadFile("txt/info.txt")
options, _ := os.ReadFile("txt/options.txt")
g, _ := gradient.NewGradient("cyan", "blue")
solid, _ := gradient.NewGradient("blue", "#1179ef")
opt, _ := gradient.NewGradient("#1179ef", "cyan")
g.Print(string(banner))
solid.Print(string(info))
opt.Print("\n" + string(options))
}

// waitForEnter pauses execution and waits for the user to press Enter.
func waitForEnter() {
fmt.Print("\n\nPress Enter to continue...")
bufio.NewReader(os.Stdin).ReadBytes('\n')
}

// clearScreen clears the terminal screen using the appropriate command for the operating system.
func clearScreen() {
var cmd *exec.Cmd
if runtime.GOOS == "windows" {
cmd = exec.Command("cmd", "/c", "cls")
} else {
cmd = exec.Command("clear")
}
cmd.Stdout = os.Stdout
cmd.Run()
}

// SatIntel initializes the SatIntel CLI application by displaying the banner and starting the menu loop.
func SatIntel() {
Banner()
Option()
Expand Down
64 changes: 64 additions & 0 deletions cli/cli_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
package cli

import (
"testing"
)

// Note: Most CLI functions are interactive and difficult to test without mocking stdin/stdout
// These tests focus on testable logic and structure validation

func TestGenRowString(t *testing.T) {
// This is a helper function that might be used in CLI package
// If GenRowString is in osint package, this test can be removed
// or we can test the formatting logic here
tests := []struct {
name string
intro string
input string
checkLen bool
}{
{
name: "Normal case",
intro: "Test",
input: "Value",
checkLen: true,
},
{
name: "Empty values",
intro: "",
input: "",
checkLen: true,
},
}

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
// This is a placeholder - adjust based on actual CLI functions
// If there are no directly testable functions, we can test file reading, etc.
_ = tt
})
}
}

// Test file reading functions (if they become testable)
func TestBannerFileReading(t *testing.T) {
// Test that banner files can be read
// This is a basic smoke test
files := []string{
"txt/banner.txt",
"txt/info.txt",
"txt/options.txt",
}

for _, file := range files {
t.Run("Read_"+file, func(t *testing.T) {
// This would require the files to exist
// For now, this is a placeholder structure
_ = file
})
}
}

// Placeholder for future CLI tests
// Add more tests as you implement testable CLI functions

35 changes: 11 additions & 24 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,33 +1,20 @@
module github.com/ANG13T/SatIntel

go 1.20
go 1.24.0

toolchain go1.24.5

require (
github.com/TwiN/go-color v1.4.0
github.com/iskaa02/qalam v0.3.0
github.com/manifoldco/promptui v0.9.0
)

require (
github.com/TwiN/go-color v1.4.0 // indirect
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/iskaa02/qalam v0.3.0 // indirect
github.com/lucasb-eyer/go-colorful v1.0.3 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/manifoldco/promptui v0.9.0 // indirect
github.com/mattn/go-runewidth v0.0.9 // indirect
github.com/mazznoer/colorgrad v0.8.1 // indirect
github.com/mazznoer/csscolorparser v0.1.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/spf13/afero v1.9.3 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/cobra v1.7.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.15.0 // indirect
github.com/subosito/gotenv v1.4.2 // indirect
golang.org/x/sys v0.3.0 // indirect
golang.org/x/text v0.5.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
golang.org/x/sys v0.39.0 // indirect
golang.org/x/term v0.38.0 // indirect
)
Loading