Skip to content

Commit

Permalink
chore: rename
Browse files Browse the repository at this point in the history
  • Loading branch information
a-kenji committed Jul 20, 2024
1 parent 11ff81d commit 245f12f
Show file tree
Hide file tree
Showing 15 changed files with 52 additions and 52 deletions.
40 changes: 20 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# `$ fe` - edit your flake inputs with ease
# `$ flake-edit` - edit your flake inputs with ease
[![Built with Nix](https://img.shields.io/static/v1?label=built%20with&message=nix&color=5277C3&logo=nixos&style=flat-square&logoColor=ffffff)](https://builtwithnix.org)
[![Crates](https://img.shields.io/crates/v/flake-edit?style=flat-square)](https://crates.io/crates/flake-edit)
[![Documentation](https://img.shields.io/badge/flake_edit-documentation-fc0060?style=flat-square)](https://docs.rs/flake-edit)
[![Matrix Chat Room](https://img.shields.io/badge/chat-on%20matrix-1d7e64?logo=matrix&style=flat-square)](https://matrix.to/#/#flake-edit:matrix.org)

`$ fe` - **f**lake **e**dit - edit your flake inputs with ease.
`$ flake-edit` - edit your flake inputs with ease.

## `$ fe` - usage
## `$ flake-edit` - usage

`fe` has the following cli interface:
`flake-edit` has the following cli interface:

`$ fe help`
`$ flake-edit help`
```
Edit your flake inputs with ease
Usage: fe [OPTIONS] [FLAKE_REF] <COMMAND>
Usage: flake-edit [OPTIONS] [FLAKE_REF] <COMMAND>
Commands:
add
Expand Down Expand Up @@ -47,12 +47,12 @@ Options:
Print version
```

### `$ fe add`
`$ fe help add`
### `$ flake-edit add`
`$ flake-edit help add`
```
Add a new flake reference
Usage: fe add [OPTIONS] [ID] [URI]
Usage: flake-edit add [OPTIONS] [ID] [URI]
Arguments:
[ID]
Expand All @@ -69,17 +69,17 @@ Options:
Print help
```
For some types, the id will be automatically inferred.
![fe add example](assets/tape/output/add_input.gif)
![flake-edit add example](assets/tape/output/add_input.gif)

For some inputs, the uri can be put in directly and the id and type will be inferred.
![fe add inferred example](assets/tape/output/add_input_inferred.gif)
![flake-edit add inferred example](assets/tape/output/add_input_inferred.gif)

### `$ fe remove`
`$ fe help remove`
### `$ flake-edit remove`
`$ flake-edit help remove`
```
Remove a specific flake reference based on its id
Usage: fe remove [ID]
Usage: flake-edit remove [ID]
Arguments:
[ID]
Expand All @@ -89,14 +89,14 @@ Options:
-h, --help
Print help
```
![fe remove example](assets/tape/output/remove_input.gif)
![flake-edit remove example](assets/tape/output/remove_input.gif)

### `$ fe list`
`$ fe help list`
### `$ flake-edit list`
`$ flake-edit help list`
```
List flake inputs
Usage: fe list [OPTIONS]
Usage: flake-edit list [OPTIONS]
Options:
--format <FORMAT>
Expand All @@ -105,9 +105,9 @@ Options:
Print help
```
List the outputs, that are specified inside the inputs attribute.
![fe list example](assets/tape/output/list_inputs.gif)
![flake-edit list example](assets/tape/output/list_inputs.gif)
List the outputs, that are specified inside the inputs attribute, in json format.
![fe list example](assets/tape/output/list_inputs_json.gif)
![flake-edit list example](assets/tape/output/list_inputs_json.gif)


## License
Expand Down
20 changes: 10 additions & 10 deletions assets/completions/fish/completions.fish
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
function __fish_complete_inputs
fe list --format simple 2>/dev/null
flake-edit list --format simple 2>/dev/null
end

function __fish_complete_add
fe completion add 2>/dev/null
flake-edit completion add 2>/dev/null
end

complete -c fe -n "__fish_seen_subcommand_from rm" -f -a "(__fish_complete_inputs)" -d Input
complete -c fe -n "__fish_seen_subcommand_from remove" -f -a "(__fish_complete_inputs)" -d Input
complete -c fe -n "__fish_seen_subcommand_from change" -f -a "(__fish_complete_inputs)" -d Input
complete -c fe -n "__fish_seen_subcommand_from c" -f -a "(__fish_complete_inputs)" -d Input
complete -c fe -n "__fish_seen_subcommand_from pin" -f -a "(__fish_complete_inputs)" -d Input
complete -c fe -n "__fish_seen_subcommand_from p" -f -a "(__fish_complete_inputs)" -d Input
complete -c flake-edit -n "__fish_seen_subcommand_from rm" -f -a "(__fish_complete_inputs)" -d Input
complete -c flake-edit -n "__fish_seen_subcommand_from remove" -f -a "(__fish_complete_inputs)" -d Input
complete -c flake-edit -n "__fish_seen_subcommand_from change" -f -a "(__fish_complete_inputs)" -d Input
complete -c flake-edit -n "__fish_seen_subcommand_from c" -f -a "(__fish_complete_inputs)" -d Input
complete -c flake-edit -n "__fish_seen_subcommand_from pin" -f -a "(__fish_complete_inputs)" -d Input
complete -c flake-edit -n "__fish_seen_subcommand_from p" -f -a "(__fish_complete_inputs)" -d Input

set -x ignore_space true
complete -c fe -n "__fish_seen_subcommand_from a" -f -r --keep-order -a "(__fish_complete_add)" -d Add
complete -c fe -n "__fish_seen_subcommand_from add" -f -r --keep-order -a "(__fish_complete_add)" -d Add
complete -c flake-edit -n "__fish_seen_subcommand_from a" -f -r --keep-order -a "(__fish_complete_add)" -d Add
complete -c flake-edit -n "__fish_seen_subcommand_from add" -f -r --keep-order -a "(__fish_complete_add)" -d Add
set -x ignore_space false
2 changes: 1 addition & 1 deletion assets/tape/list_inputs.tape
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,5 @@ Type "set -x fish_function_path ''" Enter
Type "clear" Enter
Show

Type "fe list --format detailed" Sleep 1000ms Enter
Type "flake-edit list --format detailed" Sleep 1000ms Enter
Sleep 5s
2 changes: 1 addition & 1 deletion assets/tape/list_inputs_json.tape
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,5 @@ Type "set -x fish_function_path ''" Enter
Type "clear" Enter
Show

Type "fe list --format json | jq .crane" Sleep 1000ms Enter
Type "flake-edit list --format json | jq .crane" Sleep 1000ms Enter
Sleep 5s
4 changes: 2 additions & 2 deletions doc/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Please raise an issue, to see if a potential feature is in scope of the project.
We are always happy to receive contributions and attempt to process them in a timely manner.

## Issues
To get an overview of what can be worked on, please take a look at the [issues](https://github.com/a-kenji/fe/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc).
To get an overview of what can be worked on, please take a look at the [issues](https://github.com/a-kenji/flake-edit/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc).

## How to get tools
For your convenience you only need one tool to contribute to `fe` or `flake-edit`: `nix`.
For your convenience you only need one tool to contribute to `flake-edit` or `flake-edit`: `nix`.
You can drop into a development shell with:
```
nix develop
Expand Down
2 changes: 1 addition & 1 deletion nix/apps.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ _: {
{
apps = {
default = self'.packages.default;
fe = self'.packages.fe;
flake-edit = self'.packages.flake-edit;
};
};
}
2 changes: 1 addition & 1 deletion nix/checks.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ _: {
{
checks = {
inherit (self'.packages)
fe
flake-edit
cargoArtifacts
cargoClippy
# cargoDeny
Expand Down
8 changes: 4 additions & 4 deletions nix/fe.nix → nix/flake-edit.nix
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ let
'';
in
{
fe = craneLib.buildPackage (
flake-edit = craneLib.buildPackage (
commonArgs
// {
cargoExtraArgs = "-p ${name}";
Expand All @@ -59,9 +59,9 @@ in
};
doCheck = false;
version = "unstable-" + gitDate;
pname = "fe";
name = "fe";
postInstall = postInstall "fe";
pname = "flake-edit";
name = "flake-edit";
postInstall = postInstall "flake-edit";
inherit assetDir cargoArtifacts meta;
}
);
Expand Down
4 changes: 2 additions & 2 deletions nix/meta.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{ lib, ... }:
{
homepage = "https://github.com/a-kenji/fe";
mainProgram = "fe";
homepage = "https://github.com/a-kenji/flake-edit";
mainProgram = "flake-edit";
license = [ lib.licenses.mit ];
}
6 changes: 3 additions & 3 deletions nix/packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
{ pkgs, ... }:
{
packages = rec {
default = fe;
inherit ((pkgs.callPackage ./fe.nix { inherit self; }))
fe
default = flake-edit;
inherit ((pkgs.callPackage ./flake-edit.nix { inherit self; }))
flake-edit
cargoArtifacts
cargoClippy
cargoDeny
Expand Down
4 changes: 2 additions & 2 deletions src/bin/flake-edit/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ use std::sync::OnceLock;
use directories::ProjectDirs;
use serde::{Deserialize, Serialize};

static CACHE_FILE_NAME: &str = "fe.json";
static CACHE_FILE_NAME: &str = "flake_edit.json";

fn cache_dir() -> &'static PathBuf {
static CACHE_DIR: OnceLock<PathBuf> = OnceLock::new();
CACHE_DIR.get_or_init(|| {
let project_dir = ProjectDirs::from("com", "a-kenji", "fe").unwrap();
let project_dir = ProjectDirs::from("com", "a-kenji", "flake-edit").unwrap();
return project_dir.data_dir().to_path_buf();
})
}
Expand Down
2 changes: 1 addition & 1 deletion src/bin/flake-edit/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use clap::{Parser, Subcommand};

#[derive(Parser, Debug)]
#[command(author, version = CliArgs::unstable_version(), about, long_about = None)]
#[command(name = "fe")]
#[command(name = "flake-edit")]
#[command(next_line_help = true)]
/// Edit your flake inputs with ease
pub struct CliArgs {
Expand Down
2 changes: 1 addition & 1 deletion src/bin/flake-edit/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use thiserror::Error;

#[derive(Debug, Error)]
pub enum FeError {
/// Generic fe error.
/// Generic flake-edit error.
#[allow(unused)]
#[error("Error: {0}")]
Error(String),
Expand Down
2 changes: 1 addition & 1 deletion src/bin/flake-edit/log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ pub fn init_logging(log_file: Option<PathBuf>) -> Result<(), std::io::Error> {
}

pub fn init() -> Result<(), std::io::Error> {
init_logging(Some("/tmp/fe/fe.log".into()))
init_logging(Some("/tmp/flake-edit/flake-edit.log".into()))
}
4 changes: 2 additions & 2 deletions src/bin/flake-edit/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ fn main() -> eyre::Result<()> {
eyre::eyre!("Could not infer [ID] from flake reference.")
.with_note(|| format!("The provided uri: {uri}"))
.suggestion(
"\nPlease specify an [ID] for this flake reference.\nIn the following form: `fe add [ID] [uri]`\nIf you think the [ID] should have been able to be inferred, please open an issue.",
"\nPlease specify an [ID] for this flake reference.\nIn the following form: `flake-edit add [ID] [uri]`\nIf you think the [ID] should have been able to be inferred, please open an issue.",
),
);
}
Expand Down Expand Up @@ -161,7 +161,7 @@ fn main() -> eyre::Result<()> {
"The input with id: {} could not be removed.",
change.id().unwrap()
)
.suggestion("\nPlease check if an input with that [ID] exists in the flake.nix file.\nRun `fe list --format simple` to see the current inputs by their id."));
.suggestion("\nPlease check if an input with that [ID] exists in the flake.nix file.\nRun `flake-edit list --format simple` to see the current inputs by their id."));
}
println!("Nothing changed in the node.");
println!("The following change could not be applied: \n{:?}", change);
Expand Down

0 comments on commit 245f12f

Please sign in to comment.