goshell

command module
v0.0.0-...-8c7403a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 3, 2025 License: MIT Imports: 18 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Goshell

Goshell is REPL shell for golang.

the project is inspired by rango but took different decisions.

Table of Contents

Installation

go install github.com/ahmedakef/goshell@latest

Features

  • auto import the needed libraries using goimports just write fmt.Print() and fmt will be imported.
  • autocompletion for languages keywords and libraries's functions and types without the need for language server.
  • print the variablles by writing them, no need to use fmt.Print()
  • supports all shell line editing commands supported by liner
  • don't have dependancy on goimports

Examples

live demo

Example Demo

Simple variable printing
code you write generated code
>>> a:=1
>>> b:=2
>>> a
1
package main

import "fmt"

func main() {
	a := 1
	b := 2
	fmt.Println(a)
	use(a, b)
}

// used to avoid "declared and not used" error
func use(vals ...any) {
	for _, val := range vals {
		_ = val
	}
}
3 lines17 lines
Calling functions
code you write generated code
>>> func add(x,y int) int {
...     return x+y
... }
>>> a:=1
>>> b:=2
>>> add(a,b)
3
package main

import "fmt"

func add(x, y int) int {
	return x + y
}

func main() {
	a := 1
	b := 2
	fmt.Println(add(a, b))
	use(a, b)
}

// used to avoid "declared and not used" error
func use(vals ...any) {
	for _, val := range vals {
		_ = val
	}
}
6 lines21 lines

Contact

ahmedakef - aemed.akef.1@gmail.com

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址