Skip to content

Commit

Permalink
Fix bug for init command
Browse files Browse the repository at this point in the history
  • Loading branch information
Mitchell Stanley committed Jan 20, 2020
1 parent 5aa8b83 commit 183d420
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.3.3

* Fix bug when creating config files with snipcli init

## 0.3.2

* Make compatible with Crystal 0.32.1 and 0.31.1
Expand Down
2 changes: 1 addition & 1 deletion shard.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: cli
version: 0.3.2
version: 0.3.3

authors:
- Mitchell Stanley <[email protected]>
Expand Down
2 changes: 1 addition & 1 deletion snap/snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: snipcli
version: 0.3.2
version: 0.3.3
summary: Shell Snippet organiser
description: >
Snipcli is a commandline interface for managing shell commands. Sync commands with your Snipline account or use in guest mode. Snipline lets you dynamically change command parameters easily so you never have to remember how to build a command.
Expand Down
2 changes: 1 addition & 1 deletion src/snipline_cli.cr
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module Repo
end

module SniplineCli
VERSION = "0.3.2"
VERSION = "0.3.3"

def self.config
Config.config
Expand Down
4 changes: 2 additions & 2 deletions src/snipline_cli/commands/init.cr
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ module SniplineCli
define_help description: "Initialise Snipline CLI without logging in"

def run
puts "Migrating Database..."
Migrator.run
config = SniplineCli.config
toml_contents = <<-TOML
title = "Snipline"
Expand All @@ -36,6 +34,8 @@ module SniplineCli
File.write(expand_path(config.get("general.db")), "", mode: "w")
puts "Created SQLite file in #{expand_path(config.get("general.db")).colorize.mode(:bold)}"
end
puts "Migrating Database..."
Migrator.run
puts ""
puts "Run #{"snipcli new".colorize.mode(:bold)} to create your first snippet"
puts "Search snippets with #{"snipcli search".colorize.mode(:bold)}"
Expand Down
3 changes: 2 additions & 1 deletion src/snipline_cli/services/create_config_directory.cr
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
require "../helpers/*"
module SniplineCli
module Services
# Creates a config directory for storing configuration files for SnipCLI.
class CreateConfigDirectory
def self.run(file)
directory_name = File.expand_path(File.dirname(file))
directory_name = SniplineCli::Helpers.expand_path(File.dirname(file))
unless File.directory?(directory_name)
SniplineCli.log.debug("Making config directory #{directory_name}")
Dir.mkdir(directory_name)
Expand Down

0 comments on commit 183d420

Please sign in to comment.