Giter VIP home page Giter VIP logo

cueimports's Introduction

cueimports

cueimports is a CUE tool that updates your import lines, adding missing ones and removing unused ones.

It scans through:

  • your local packages
  • the cue.mod directory packages
  • the standard library packages

Install

go install github.com/asdine/cueimports/cmd/cueimports

Usage

$ echo "data: json.Marshal({a: math.Sqrt(7)})" | cueimports
import (
	"encoding/json"
	"math"
)

data: json.Marshal({a: math.Sqrt(7)})

cueimports's People

Contributors

asdine avatar johnallen3d avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

cueimports's Issues

Issue with mismatched packages

I've recently discovered your excellent VS Code extension, which I believe will effectively kill my CUE related extension, and cueimports. ๐Ÿ‘

One thing that I haven't yet been able to get working is a package that doesn't match the directory name it's contained in (indicated with the package name after a :).

In this contrived example, I have the following structure.

โฏ lsd --tree
๏„• .
โ”œโ”€โ”€ ๏„• cue.mod
โ”‚   โ”œโ”€โ”€ ๏€ module.cue
โ”‚   โ”œโ”€โ”€ ๏„• pkg
โ”‚   โ””โ”€โ”€ ๏„• usr
โ”œโ”€โ”€ ๏€ foo.cue
โ””โ”€โ”€ ๏„• hello
    โ””โ”€โ”€ ๏€ world.cue

With a module named example.com/test.

โฏ cat cue.mod/module.cue
module: "example.com/test"

Inside the hello directory I have a package named world (real-world use case is dealing with legacy configuration).

โฏ cat hello/world.cue
package world

#person: {
	name: string
}

Then I import the world package in foo.cue.

โฏ cat foo.cue
package foo

import "example.com/test/hello:world"

bar: world.#person & {
	name: "John"
}

This works fine when I cue export.

โฏ cue export foo.cue --outfile -
{
    "bar": {
        "name": "John"
    }
}

However, cueimports ditches the import of the world package.

โฏ cat foo.cue | cueimports
package foo

bar: world.#person & {
	name: "John"
}

I've attached the above in case it helps with troubleshooting.
cue-playground.zip

Package cueimports cli tool as zip archives on Windows for seamless winget installation

As a user,
I want the cueimports cli tool to be released as zip archives on Windows
So that it can be seamlessly installed using winget.

Current Situation

Currently, the cueimports cli tool is released as tar.gz archives on Windows. This format is not recognized by the Windows Package Manager (winget), which means that users cannot install cueimports seamlessly using winget.

Problem

The lack of winget support for cueimports on Windows makes it more difficult for users to install the tool. Users have to manually download and extract the tar.gz archive, which can be a cumbersome process.

Proposed Solution

To address this issue, we propose packaging the cueimports cli tool as zip archives on Windows. Zip archives are natively supported by winget, so users will be able to install cueimports seamlessly using the winget command.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.